Data Structures & AlgorithmsVery hardGATE CS · Product-company placement

What is the minimum possible number of nodes in an AVL tree of height 4? (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. 11
  2. B. 31
  3. C. 12
  4. D. 13

Correct answer: C. 12

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