Similar questions 2 more →
Binary Search & Balanced Trees


Answer & solution
Answer: N(h)=1+N(h−1)+N(h−2); edge-height bases N(−1)=0,N(0)=1. (no official key was published)
Take height to count edges on a longest root-to-leaf path; an empty tree has height −1 and a leaf height 0. A tree of height h must have at least one child subtree of height h−1. AVL balance permits the other to be no shorter than h−2. To minimize nodes, choose exactly those two heights and make both subtrees themselves minimum-size AVL trees. Counting the root gives N(h)=1+N(h−1)+N(h−2), with N(−1)=0,N(0)=1.
This is both a lower bound and attainable: recursively attach extremal subtrees of heights h−1 and h−2 to a root. The height difference is one, so the construction is AVL. Writing M(h)=N(h)+1 gives M(h)=M(h−1)+M(h−2), and the bases imply N(h)=Fh+3−1 when F0=0,F1=1.
If height instead counts levels, the empty tree is height 0 and a leaf height 1, so the same recurrence has bases N(0)=0,N(1)=1 and formula Fh+2−1. The recurrence is structural; the indexing convention must not be mixed between parts.