Data Structures & AlgorithmsHardGATE CS · Product-company placement

What is the minimum possible number of nodes in an AVL tree of height 8? (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. 89
  2. B. 87
  3. C. 88
  4. D. 511

Correct answer: C. 88

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