Consider a binary tree T that has 200 leaf nodes. Then, the number of nodes in T that have exactly two children are …
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2015 Set 3 · Q25
Time
Your answerNumerical answer
Solution
Official answer: 199
TreesIn any binary tree , let:
= number of leaf nodes (nodes with degree 0 / no children)
= number of nodes with exactly 1 child
= number of nodes with exactly 2 children
The total number of nodes is .
The total number of edges in any tree with nodes is .
Counting edges by outgoing degree of nodes:
Equating the two expressions for :
Given :
Try the question first, then check your work.
Examiner trap
Recall the fundamental relation for binary trees: , where is the number of nodes with two children and is the number of leaf nodes.
This Trees previous year question is Q25 of the GATE CSE 2015 Set 3 paper. Find more GATE CSE PYQs on Trees in Programming and Data Structures, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Trees PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Trees has 13 GATE CSE PYQs across 11 papers from 2012 to 2026. 5 of them are 1-mark NAT questions like this one, and it is the only one in GATE CSE 2015 Set 3.
How GATE tests TreesIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.