Let be an odd number greater than . Consider a binary minheap with elements stored in an array whose index starts from . Which of the following indices of do/does NOT correspond to any leaf node of the minheap?
GATE CSE · Programming In C
Practice problems for Heap in Programming in C.
35 questions · 20 PYQs · 0 AI practice · GATE CSE 2027
🎯 These are sample questions
Just sign in to unlock everything. Free for all students.
Let be an odd number greater than . Consider a binary minheap with elements stored in an array whose index starts from . Which of the following indices of do/does NOT correspond to any leaf node of the minheap?
A meld operation on two instances of a data structure combines them into one single instance of the same data structure. Consider the following data structures: P: Unsorted doubly linked list with pointers to the head node and tail node of the list. Q: Min-heap implemented using an array. R: Binary Search Tree. Which ONE of the following options gives the worst-case time complexities for meld operation on instances of size of these data structures?
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 stores 32 keys. The height of is _____________. (Answer in integer)
An array is heapified. Which one of the following options represents the first three elements in the heapified array?
Consider a binary min-heap containing 105 distinct elements. Let be the index (in the underlying array) of the maximum element stored in the heap. The number of possible values of is
Which one of the following sequences when stored in an array at locations A[1], . . . , A[10] forms a max-heap?
Let A be a priority queue for maintaining a set of elements. Suppose A is implemented using a max-heap data structure. The operation Extract-Max(A) extracts and deletes the maximum element from A. The operation Insert(A,key) inserts a new element key in A. The properties of a max-heap are preserved at the end of each of these operations. When A contains n elements, which one of the following statements about the worst case running time of these two operations is TRUE?
Let H be a binary min-heap consisting of n elements implemented as an array. What is the worst case time complexity of an optimal algorithm to find the maximum element in H?
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 ___________.
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 time. IV. A binary search tree can be constructed from a max-heap in time. Which of the above statements is/are TRUE?
Given a binary-max heap. The elements are stored in an arrays as 25,14,16,13,10,8,12. What is the content of the array after two delete operations?
The number of possible min-heaps containing each value from {1, 2, 3, 4, 5, 6, 7} exactly once is _____.
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 thearray.If the heap tree has depth d (number of edges on the path from the root to the farthest leaf),the n what is the time complexity to re-fix the heap efficiently after the removal of the element?
A complete binary min-heap is made by including each integer in [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_____. .
Consider the following array of elements. (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
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
Consider a max heap, represented by the array: 40, 30, 20, 10, 15, 16, 17, 8, 4. Now consider that a value 35 is inserted into this heap. After insertion, the new heap is

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:
A max-heap is a heap where the value of each parent is greater than or equal to the value of its children. Which of the following is a max-heap?

Consider a binary max-heap implemented using an array. Which one of the following array represents a binary max-heap?
Want unlimited AI-generated Heap questions?
Sign up free and practice with adaptive difficulty — Easy, Medium, Hard. New questions every session.
Start practising for free →