GATE 2024 CS (CS1) – Question 41
An array [82, 101, 90, 11, 111, 75, 33, 131, 44, 93] is heapified. Which one of the following options represents the first three elements in the heapified array?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (D) 131, 111, 90
Explanation
Build-max-heap bottom-up places the maximum 131 at the root. The second level ends up with 111 and 90, so the first three are 131, 111, 90.