GATE Computer ScienceVery hardGATE CSE

How many structurally distinct binary trees (left and right children distinguished) with exactly 7 nodes have height exactly 3, where height is the number of edges on the longest root-to-leaf path?

  1. A. 98
  2. B. 48
  3. C. 68
  4. D. 69

Correct answer: C. 68

Let T(n,h) count trees with n nodes and height ≤ h; the answer is T(7,3) − T(7,2) = 69 − 1 = 68.

More Programming and Data Structures (GATE) questions

Exams that ask this topic