Exams › GATE › Technical
Consider a binary min-heap containing 105 distinct elements. Let k be the index (in the underlying array) of the maximum element stored in the heap. The number of possible values of k is
- 53
- 52
- 27
- 1
Correct answer: 53
Solution
In a binary min-heap, the maximum element can only be found in the leaf nodes, which are located in the second half of the array representation. With 105 elements, the leaf nodes start from index 53 to 105, giving us a total of 53 possible indices for the maximum element.
Related GATE Technical questions
⚔️ Practice GATE Technical free + battle 1v1 →