Binary Heaps questions

Q23

GATE CS 2026 CS-1Tree Data StructuresMSQ1 mark
Let nn be an odd number greater than 100. Consider a binary minheap with nn elements stored in an array PP whose index starts from 1.

Which of the following indices of PP do/does NOT correspond to any leaf node of the minheap?
More than one option can be correct.
Show answer without attempting

Answer: B, C

Q35

GATE CS 2025 CS-1Tree Data StructuresNAT1 mark
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)
Show answer without attempting

Answer: 5

Q41

GATE CS 2024 CS-1Tree Data StructuresMCQ2 marks−2/3 if wrong
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?
Show answer without attempting

Answer: D

Q43

GATE CS 2024 CS-1Tree Data StructuresMCQ2 marks−2/3 if wrong
Consider a binary min-heap containing 10510^5 distinct elements. Let kk be the index (in the underlying array) of the maximum element stored in the heap. The number of possible values of kk is
Show answer without attempting

Answer: A

Q12

GATE CS 2023 CSTree Data StructuresMCQ1 mark−1/3 if wrong
Which one of the following sequences when stored in an array at locations A[1],…,A[10]A[1], \dots, A[10] forms a max-heap?
Show answer without attempting

Answer: B

Q46

GATE CS 2023 CSTree Data StructuresMCQ2 marks−2/3 if wrong
Let AA be a priority queue for maintaining a set of elements. Suppose AA is implemented using a max-heap data structure. The operation EXTRACT-MAX(A) extracts and deletes the maximum element from AA. The operation INSERT(A, key) inserts a new element key in AA. The properties of a max-heap are preserved at the end of each of these operations.

When AA contains nn elements, which one of the following statements about the worst case running time of these two operations is TRUE?
Show answer without attempting

Answer: B

Q2

GATE CS 2021 CS-2Tree Data StructuresMCQ1 mark−1/3 if wrong
Let HH be a binary min-heap consisting of nn elements implemented as an array. What is the worst case time complexity of an optimal algorithm to find the maximum element in HH?
Show answer without attempting

Answer: C

Q47

GATE CS 2020 CSTree Data StructuresNAT2 marks
Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons required to find the maximum in the heap is __________.
Show answer without attempting

Answer: 511

Q40

GATE CS 2019 CSTree Data StructuresMCQ2 marks−2/3 if wrong
Consider the following statements:
I. The smallest element in a max-heap is always at a leaf node
II. The second largest element in a max-heap is always a child of the root node
III. A max-heap can be constructed from a binary search tree in Θ(n)\Theta(n) time
IV. A binary search tree can be constructed from a max-heap in Θ(n)\Theta(n) time

Which of the above statements are TRUE?
Show answer without attempting

Answer: A

Q46

GATE CS 2018 CSTree Data StructuresNAT2 marks
The number of possible min-heaps containing each value from {1,2,3,4,5,6,7}\{1, 2, 3, 4, 5, 6, 7\} exactly once is _____.
Show answer without attempting

Answer: 80

Q37

GATE CS 2016 CS-1Tree Data StructuresMCQ2 marks−2/3 if wrong
An operator delete(i) for a binary heap data structure is to be designed to delete the item in the i-th node. Assume that the heap is implemented in an array and i refers to the i-th index of the array. If the heap tree has depth d (number of edges on the path from the root to the farthest leaf), then what is the time complexity to re-fix the heap efficiently after the removal of the element?
Show answer without attempting

Answer: B

Q34

GATE CS 2016 CS-2Tree Data StructuresNAT2 marks
A complete binary min-heap is made by including each integer in [1,1023][1, 1023] exactly once. The depth of a node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth 0. The maximum depth at which integer 9 can appear is _________.
Show answer without attempting

Answer: 8.0

Q30

GATE CS 2015 CS-3Tree Data StructuresMCQ1 mark−1/3 if wrong
Consider the following array of elements.

(89,19,50,17,12,15,2,5,7,11,6,9,100)(89, 19, 50, 17, 12, 15, 2, 5, 7, 11, 6, 9, 100)

The minimum number of interchanges needed to convert it into a max-heap is
Show answer without attempting

Answer: D

Q37

GATE CS 2015 CS-1Tree Data StructuresMCQ2 marks−2/3 if wrong
Consider a max heap, represented by the array: 40, 30, 20, 10, 15, 16, 17, 8, 4.
Array Index123456789
Value4030201015161784
Now consider that a value 35 is inserted into this heap. After insertion, the new heap is
Show answer without attempting

Answer: B

Q22

GATE CS 2015 CS-2Tree Data StructuresMCQ1 mark−1/3 if wrong
Consider a complete binary tree where the left and the right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is
Show answer without attempting

Answer: A

Q12

GATE CS 2014 CS-2Tree Data StructuresMCQ1 mark−1/3 if wrong
A priority queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is: 10, 8, 5, 3, 2. Two new elements 1 and 7 are inserted into the heap in that order. The level-order traversal of the heap after the insertion of the elements is:
Show answer without attempting

Answer: A

0/160 correct0 marks

Related topics in Tree Data Structures