In a binary tree where every node has zero or two children, if $n$ is the total number of nodes, how many nodes have exactly two children?
Correct Answer :
(n-1)/2
Solution :
The correct option is (n-1)/2.
Let's analyze the structure of the binary tree step-by-step to understand why this formula holds true.
In a binary tree where every node has either zero or two children, the tree is known as a strict (or full) binary tree. Let:
- be the number of leaf nodes (nodes with 0 children).
- be the number of internal nodes with exactly 2 children.
- be the total number of nodes in the tree.
Since every node in this tree has either 0 or 2 children, there are no nodes with exactly 1 child. Therefore, the total number of nodes is the sum of the leaf nodes and the nodes with two children:
Now, let's look at the relationship between the number of edges and the nodes in any tree:
1. A tree with nodes has exactly edges.
2. We can also count the number of edges by looking at the outgoing branches from the nodes. A leaf node () contributes 0 outgoing edges, and a node with two children () contributes 2 outgoing edges. Therefore, the total number of edges is:
Equating the two expressions for the total number of edges gives:
To find the number of nodes with exactly two children (), we solve the equation for :
Thus, the number of nodes with exactly two children is indeed .
Access expert-curated educational resources and study materials—completely free.
Create, conduct, and manage professional online assessments with Mindyard. Perfect for teachers and institutes.
Copyright © 2026 Mindyard. All Rights Reserved.