Skip to content
GATEiit

GATE CSE 2025 Session 1 Q35: Height of a min-heap with 32 keys

Question

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 TT stores 32 keys. The height of TT is _____________. (Answer in integer)

Try it: numerical answer: type the value

Numerical answer. No negative marking.
Show answer and explanation

Answer: 5 (official GATE 2025 final answer key)

Concept used: A heap is a complete binary tree, so its height is ⌊log⁡2n⌋\lfloor \log_2 n \rfloor.

First step: Levels 0 to 4 hold 1+2+4+8+16=311 + 2 + 4 + 8 + 16 = 31 keys, so the 32nd key starts a new level.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2025 Session 1 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key