GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Binary trees (unlabelled, left and right children distinguished) with exactly 6 nodes: how many have height exactly 3 (a single node has height 0)?

  1. A. 28
  2. B. 54
  3. C. 40
  4. D. 70

Correct answer: C. 40

Of the C6 = 132 trees, enumerating by the heights of the left and right subtrees gives 0, 0, 4, 40, 56, 32 trees of heights 0 to 5; height 5 is the 2^5 = 32 chains.

More Programming and Data Structures (GATE) questions

Exams that ask this topic