Data Structures & AlgorithmsHardProduct-company MCQ pattern

What is the minimum number of nodes in an AVL tree of height 4 (a single node has height 0)?

  1. A. 31
  2. B. 7
  3. C. 12
  4. D. 15

Correct answer: C. 12

N(h) = N(h − 1) + N(h − 2) + 1 with N(0) = 1, N(1) = 2: N(2) = 4, N(3) = 7, N(4) = 12. 31 is the maximum (a perfect tree), and 7 is N(3).

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic