Consider a binary tree in which every node has either zero or two children. Let be the number of nodes in .
Which ONE of the following is the number of nodes in that have exactly two children?
GATE CSE 2025Data Structures › Trees & Binary Search TreesVerified
(B) n − 1 2 \frac{n-1}{2} 2 n − 1
Use the standard structural identities for a full binary tree (every node has either 0 or 2 children): the number of leaves equals the number of internal (degree-2) nodes plus one, and these two classes together account for all n nodes. Solve the resulting linear equation for the number of degree-2 nodes in terms of n.
In a full binary tree, $n = 2I + 1$ where $I$ is the number of internal (two-child) nodes, giving $I = \frac{n-1}{2}$. Only option B matches this result, and all community answers agree.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.