Question
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?
Official answer and solution
- Official answer
- B
- From
- Official GATE 2025 answer key
Solution
Use the relationship between the total nodes and the internal nodes in a full binary tree.
Let be the number of internal nodes (nodes with exactly two children) and be the number of leaf nodes (nodes with zero children). In any full binary tree, . Since the total number of nodes is , we have:
Option (B)
Confusing the number of leaf nodes with the number of internal nodes .
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2025 Computer Science and Information Technology - Session 2 (CS2)
- Question
- 13 of 65
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.