GATE / CS ARCHIVE

GATE CSE 1993 / QUESTION 16

Leaves in a full binary tree

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

GATE 1993, Q16 5 marks · Descriptive
Report issue

Trees & Connectivity

Question 16, GATE 1993: Prove by mathematical induction that a binary tree in which every non-leaf node has two descendants has one more leaf than non-leaf node. Interpret descendants here as immediate children, i.e. a finite nonempty full binary tree.
Tap to enlarge
Answer & solution

Answer: L=I+1 for every finite nonempty full binary tree. (no official key was published)

Let I be the number of internal (non-leaf) nodes and L the number of leaves. We prove L=I+1 by strong induction on I for finite nonempty full binary trees.

Base case I=0: there is only the root, and it is a leaf. Thus L=1=I+1. The empty tree is excluded: it would have L=I=0 and would not satisfy the stated formula.

Inductive hypothesis: for every full binary tree with fewer than k internal nodes, the number of leaves is one more than the number of internal nodes. Consider a tree with k>=1 internal nodes. Its root is internal and, by the full-tree condition, has exactly two children. The subtrees rooted at these children are nonempty full binary trees; call their internal and leaf counts I1,L1 and I2,L2. Each Ii<k, and k=1+I1+I2. The induction hypothesis applies to both subtrees: L1=I1+1 and L2=I2+1. Their leaves are disjoint and are exactly the leaves of the original tree, since the root is not a leaf. Hence L=L1+L2=I1+I2+2=k+1. This completes the induction.

An equivalent structural induction starts with one leaf and replaces any leaf by an internal node with two new leaf children. Every such operation increases I by one and increases L by one (remove one leaf, add two), preserving L−I=1. As an independent check, a tree with I+L vertices has I+L−1 edges; counting edges by parents gives 2I, so 2I=I+L−1. The immediate-child interpretation matters: general binary trees permitting a single child need not obey the formula.

Original paper, page 12