Question 1
Suppose we are sorting an array of eight integers using heapsort, and we have just finished some heapify (either maxheapify or minheapify) operations. The array now looks like this: 16 14 15 10 12 27 28 How many heapify operations have been performed on root of heap?
1
2
3 or 4
5 or 6
Question 2
Which languages necessarily need heap allocation in the run time environment?
Those that support recursion
Those that use dynamic scoping
Those that use global variables
Those that allow dynamic data structures
Question 3
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?
Θ(1)
Θ(logn)
Θ(n)
Θ(nlogn)
Question 4
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
4
5
2
3
Question 6
What are the applications of the Heap data structure?
Medical Applications
File Compression
Stock market
All of these
Question 7
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 _________ .
510
511
512
255
Question 8
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?
14,13,8,12,10
14,12,13,10,8
14,13,12,8,10
14,13,12,10,8
Question 9
The number of nodes of height h in any n - element heap is __________.
h
2h
ceil(n/2h)/
ceil(n/2h+1)
Question 10
There are 30 questions to complete.