Home › Previous year questions › GATE 2024 CS (CS1) › Question 43GATE 2024 CS (CS1) – Question 43 Programming and Data Structures · Binary Heaps · 2 marks · Multiple choice
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 Practise this question in The GATE Grind →
Show answer and explanation Correct answer: (A) 53
Explanation In a min-heap the maximum must be at a leaf. With n=105, leaves occupy indices ⌊105/2⌋+1 = 53 through 105, giving 53 possible values.
More Binary Heaps questions GATE 2023 CS Q12 – Which one of the following sequences when stored in an array at locations A[1],...,A[10]… GATE 2023 CS Q46 – Let A be a priority queue for maintaining a set of elements. Suppose A is implemented… GATE 2022 CS Q28 – Suppose a binary search tree with 1000 distinct elements is also a complete binary tree.… GATE 2020 CS Q57 – Consider the array representation of a binary min-heap containing 1023 elements. The… GATE 2018 CS Q56 – The number of possible min-heaps containing each value from \1,2,3,4,5,6,7\ exactly once… GATE 2015 CS (CS1) Q37 – Consider a max heap, represented by the array: 40, 30, 20, 10, 15, 16, 17, 8, 4. Array… All Binary Heaps questions →