Heap Tree


Q11.

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
GateOverflow

Q12.

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
GateOverflow

Q13.

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_____. .
GateOverflow

Q14.

A data structure is required for storing a set of integers such that each of the following operations can be done in O(\log n) time, where n is the number of elements in the set. 1. Deletion of the smallest element 2. Insertion of an element if it is not already present in the set Which of the following data structures can be used for this purpose?
GateOverflow

Q15.

Consider a binary max-heap implemented using an array. Which one of the following array represents a binary max-heap?
GateOverflow

Q16.

Consider a binary max-heap implemented using an array. What is the content of the array after two delete operations on {25,14,16,13,10,8,12}
GateOverflow

Q17.

Consider the process of inserting an element into a Max Heap, where the Max Heap 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:
GateOverflow

Q18.

We have a binary heap on n elements and wish to insert n more elements (not necessarily one after another) into this heap. The total time required for this is
GateOverflow

Q19.

The number of possible min-heaps containing each value from {1, 2, 3, 4, 5, 6, 7} exactly once is _____.
GateOverflow

Q20.

Which of the following sequences of array elements forms a heap?
GateOverflow