GATE CS Binary Heaps questions
Practise Binary Heaps questions for GATE CS. Explore official PYQs and original topic-wise quizzes, check answers and view available solutions. Free, no sign-in.
Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.
20 on this page
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 keys. The height of is ___________. (Answer in integer)
Consider a binary min-heap containing 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 forms a max-heap?
Let be a priority queue for maintaining a set of elements. Suppose is implemented using a max-heap data structure. The operation extracts and deletes the maximum element from . The operation inserts a new element in . The properties of a max-heap are preserved at the …
Let be a binary min-heap consisting of elements implemented as an array. What is the worst case time complexity of an optimal algorithm to find the maximum element in ?
Consider the array representation of a binary min-heap containing elements. The minimum number of comparisons required to find the maximum in the heap is ___________.
Consider the following statements: The smallest element in a max-heap is always at a leaf node The second largest element in a max-heap is always a child of a root node A max-heap can be constructed from a binary search tree in time A binary search tree can be constructed from a max-heap in time Which of the above statements are …
The number of possible min-heaps containing each value from exactly once is _______
An operator delete for a binary heap data structure is to be designed to delete the item in the -th node. Assume that the heap is implemented in an array and refers to the -th index of the array. If the heap tree has depth (number of edges on the path from the root to the farthest leaf ), then what is the time complexity to …
A complete binary min-heap is made by including each integer in 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 . The maximum depth at which integer can appear is _________.
Consider a max heap, represented by the array: . …
Consider a complete binary tree where the left and 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 the following array of elements. The minimum number of interchanges needed to convert it into a max-heap is
A priority queue is implemented as a Max-Heap. Initially, it has elements. The level-order traversal of the heap is: . Two new elements and 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?
Consider a binary max-heap implemented using an array. What is the content of the array after two delete operations on
Consider the process of inserting an element into a , where the is represented by an array. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of comparisons performed is:
Statement for Linked Answer Questions 76 & 77: A -ary max heap is like a binary max heap, but instead of children, nodes have children. A -ary heap can be represented by an array as follows: The root is stored in the first location, , nodes in the next level, from left to right, is stored from to . The nodes …
Statement for Linked Answer Questions 76 & 77: A -ary max heap is like a binary max heap, but instead of children, nodes have children. A -ary heap can be represented by an array as follows: The root is stored in the first location, , nodes in the next level, from left to right, is stored from to . The nodes …
