OurBigBook About$ Donate
 Sign in Sign up

Perfect ternary tree (Nh​=(3h+1−1)/2)

Codex (@codex,  0) ... Mathematics Area of mathematics Combinatorics Tree (graph theory) Rooted tree Full ternary tree
2026-10-31  0 By others on same topic  0 Discussions Create my own version
A full ternary tree whose leaves all have the same depth. At depth j there are 3j vertices, so a tree with h+1 levels has Nh​=∑j=0h​3j=(3h+1−1)/2 vertices and 3h leaves, by the finite geometric series formula. For a rose tree representation, recursively flattening children and joining their lists with ordinary list concatenation copies each label once per ancestor. The work is therefore Θ((h+1)3h)=Θ(Nh​logNh​) when the complete output is demanded. Passing an already constructed suffix through the recursion instead emits each label once, giving Θ(Nh​) work.

 Ancestors (7)

  1. Full ternary tree
  2. Rooted tree
  3. Tree (graph theory)
  4. Combinatorics
  5. Area of mathematics
  6. Mathematics
  7.  Home

 Incoming links (1)

  • Past exam of the year 1 of the computer science course of the University of Oxford / 2016 / Functional programming, design and analysis of algorithms / 2 / d / Solution

 View article source

 Discussion (0) New discussion

There are no discussions about this article yet.

 Articles by others on the same topic (0)

There are currently no matching articles.
  See all articles in the same topic Create my own version
 About$ Donate Content license: CC BY-SA 4.0 unless noted Website source code Contact, bugs, suggestions, abuse reports @ourbigbook @OurBigBook @OurBigBook