The number of leaf nodes in a rooted tree of n nodes, with each node having or children is:
View worked solution
Answer: D
Let be the number of leaf nodes (nodes with children) and be the number of internal nodes (nodes with children).
The total number of nodes is the sum of leaf nodes and internal nodes:
Since each internal node has exactly children, the total number of children in the tree is . In any rooted tree, every node except the root is a child of exactly one node. Therefore, the total number of nodes is also given by:
Solving for :
Substitute the value of from Equation 2 into Equation 1:
Thus, the number of leaf nodes is .
Alternative Verification:
Consider a tree with just a root and its children ():
- Number of leaf nodes .
- Substituting into the options:
- Option A:
- Option B:
- Option C:
- Option D:
Only Option D matches the correct count.
Free practice · Your answers on this page are not saved.
