The height of any rooted tree is defined as the maximum number of edges in the path from the root node to any leaf node. Suppose a Min-Heap T stores 32 keys. The height of T is … (Answer in integer)
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2025 Set 1 · Q35
Time
Your answerNumerical answer
Solution
Official answer: 5
Binary HeapsA binary min-heap with elements is a complete binary tree.
The height (defined as the number of edges on the longest path from the root to any leaf) of a complete binary tree with nodes is given by:
For :
Alternatively, considering levels:
Level 0: node
Level 1: nodes
Level 2: nodes
Level 3: nodes
Level 4: nodes
Total nodes up to level 4 = nodes.
The node is located at level 5. Thus, the maximum path from the root to a leaf node consists of 5 edges.
Try the question first, then check your work.
Examiner trap
A binary heap is a complete binary tree. The height in terms of edges for nodes is .
This Binary Heaps previous year question is Q35 of the GATE CSE 2025 Set 1 paper. Find more GATE CSE PYQs on Binary Heaps 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 Binary Heaps 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.
Binary Heaps has 15 GATE CSE PYQs across 13 papers from 2011 to 2026. This is the only 1-mark NAT question among them, and it is the only one in GATE CSE 2025 Set 1.
How GATE tests Binary HeapsIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.