Skip to content
Official PYQ · 2007

GATE CS 2007 Q13 — Trees

Explain with AI

The maximum number of binary trees that can be formed with three unlabeled nodes is:

Choose one option
View worked solution

Answer: B

The number of structurally unique binary trees that can be formed with nn unlabeled nodes is given by the nthn^{\text{th}} Catalan number, CnC_n:

Cn=1n+1(2nn)C_n = \frac{1}{n+1} \binom{2n}{n}

For n=3n = 3 unlabeled nodes, we calculate C3C_3 as follows:

C3=13+1(63)=14×20=5C_3 = \frac{1}{3+1} \binom{6}{3} = \frac{1}{4} \times 20 = 5

The 55 distinct structural shapes of these binary trees are:

  1. Left-skewed (straight): Root →\rightarrow Left →\rightarrow Left
  2. Left-skewed (zigzag): Root →\rightarrow Left →\rightarrow Right
  3. Balanced: Root with one Left child and one Right child
  4. Right-skewed (zigzag): Root →\rightarrow Right →\rightarrow Left
  5. Right-skewed (straight): Root →\rightarrow Right →\rightarrow Right

Thus, the maximum number of binary trees that can be formed is 5.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Trees questions