GATE Computer ScienceVery hardGATE CS (PYQ pattern)

How many structurally distinct AVL trees (left and right distinguished, shape only) have exactly 9 nodes?

  1. A. 48
  2. B. 38
  3. C. 44
  4. D. 1430

Correct answer: C. 44

Count shapes by height with N(n, h) = sum over left/right splits of N(l, hl) N(r, hr) where max(hl, hr) = h - 1 and |hl - hr| <= 1; summing over heights for 9 nodes gives 44.

More Programming and Data Structures (GATE) questions

Exams that ask this topic