The GATE Grind

GATE 2025 CS (CS1) – Question 35

Programming and Data Structures · Binary Heaps · 1 mark · Numerical answer

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)

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 5

Explanation

A heap is a complete binary tree, so its height is floor(log2 n) = floor(log2 32) = 5.