Data Structures & AlgorithmsHardGATE CS · Product-company placement

What is the minimum possible number of nodes in an AVL tree of height 6? (Height counts edges on the longest root-to-leaf path, so a single node has height 0; in an AVL tree the two subtrees of every node differ in height by at most one.)

  1. A. 33
  2. B. 32
  3. C. 64
  4. D. 127

Correct answer: A. 33

A minimum AVL tree of height h has a root with subtrees of heights h − 1 and h − 2, so N(h) = N(h − 1) + N(h − 2) + 1 with N(0) = 1 and N(1) = 2. The +1 for the root is what the trap options drop.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic