GATE / CS ARCHIVE

GATE CSE 1994 / QUESTION 5

Induction on full ternary trees

Discrete Mathematics · Trees & Connectivity · Full GATE CSE 1994 paper

GATE 1994, Q5 Descriptive
Report issue

Trees & Connectivity

Question 5, GATE 1994: A 3-ary tree has exactly three children at every internal node. Use induction to prove that with n internal nodes it has 2(n−1)+3 leaves (GateForum). GFG instead prints 2(n−1).
Tap to enlarge
Answer & solution

Answer: The formula as printed is false; with +3 (2n+1 leaves) it holds (no official key was published)

1. Base n=1: a root with three children has three leaves, equal to 2(1−1)+3.

2. For any full ternary tree with n+1 internal nodes, choose a deepest internal node. Its three children are leaves. Prune those three children, making their parent a leaf.

3. The smaller tree has n internal nodes and, by induction, 2n+1 leaves. Restoring the three children replaces one leaf by three, increasing the leaf count by two. Thus the original has 2n+3=2((n+1)−1)+3 leaves.

4. The single-node tree n=0 also satisfies 2n+1=1 if that case is included.

  • Both say interval nodes, understood as internal nodes from the definition.

Original paper, page 5