Skip to content
Official PYQ · 1992

GATE CS 1992 Q02 — Trees

Explain with AI

A 2−32-3 tree is such that

  1. All internal nodes have either 22 or 33 children
  2. All paths from root to the leaves have the same length

The number of internal nodes of a 2−32-3 tree having 99 leaves could be

Select all correct options
View worked solution

Answer: A;D

Let hh be the height of the 2−32-3 tree (where the root is at level 00 and the leaves are at level hh). Since all leaves are at the same depth, we can analyze the tree structure based on hh:

  • Case 1: h=2h = 2
    Let the root have c0c_0 children, where c0∈{2,3}c_0 \in \{2, 3\}. Each of these children is an internal node at level 1, which must have either 22 or 33 leaf children.
    • If c0=2c_0 = 2, the maximum number of leaves is 3+3=6<93 + 3 = 6 < 9.
    • If c0=3c_0 = 3, the only way to get 99 leaves is if each of the 33 internal nodes has exactly 33 children (3+3+3=93 + 3 + 3 = 9).
    The total number of internal nodes is root+level 1 nodes=1+3=4\text{root} + \text{level 1 nodes} = 1 + 3 = 4. This matches Option A.
  • Case 2: h=3h = 3
    Let N2N_2 be the number of internal nodes at level 2. These nodes must produce 99 leaves, so: 2x+3y=92x + 3y = 9 where xx and yy are the number of level 2 nodes with 22 and 33 children respectively, and N2=x+yN_2 = x + y.
    • If y=3y = 3, then x=0  ⟹  N2=3x = 0 \implies N_2 = 3. However, we cannot form 33 nodes at level 2 from level 1 because the minimum children from a root of degree ≥2\ge 2 is 2+2=42 + 2 = 4.
    • If y=1y = 1, then x=3  ⟹  N2=4x = 3 \implies N_2 = 4. We can form 44 nodes at level 2 if the root has 22 children, and each of those has 22 children (2+2=42 + 2 = 4).
    The total number of internal nodes is root+level 1 nodes+level 2 nodes=1+2+4=7\text{root} + \text{level 1 nodes} + \text{level 2 nodes} = 1 + 2 + 4 = 7. This matches Option D.
  • Case 3: h≥4h \ge 4
    The minimum number of leaves for height h≥4h \ge 4 is 24=16>92^4 = 16 > 9, so no solutions exist here.

Thus, the possible number of internal nodes is 44 or 77.

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

Published
Report a correction
Keep exploringMore Trees questions