Question 1
The number of possible min-heaps containing each value from {1, 2, 3, 4, 5, 6, 7} exactly once is _______. Note -This was Numerical Type question.
80
8
20
210
Question 2
A max-heap is a heap where the value of each parent is greater than or equal to the values of its children. Which of the following is a max-heap?
A
B
C
D
Question 3
Which languages necessarily need heap allocation in the runtime environment?
Those that support recursion
Those that use dynamic scoping
Those that allow dynamic data structures
Those that use global variables
Question 4
Consider the data given in above question. What is the content of the array after two delete operations on the correct answer to the previous question?
14,13,12,10,8
14,12,13,8,10
14,13,8,12,10
14,13,12,8,10
Question 5
Consider a binary max-heap implemented using an array. Which one of the following array represents a binary max-heap?
25,12,16,13,10,8,14
25,14,13,16,10,8,12
25,14,16,13,10,8,12
25,14,12,13,10,8,16
Question 6
A 3-ary max heap is like a binary max heap, but instead of 2 children, nodes have 3 children. A 3-ary heap can be represented by an array as follows: The root is stored in the first location, a[0], nodes in the next level, from left to right, is stored from a[1] to a[3]. The nodes from the second level of the tree from left to right are stored from a[4] location onward. An item x can be inserted into a 3-ary heap containing n items by placing x in the location a[n] and pushing it up the tree to satisfy the heap property. Suppose the elements 7, 2, 10 and 4 are inserted, in that order, into the valid 3- ary max heap found in the above question, Which one of the following is the sequence of items in the array representing the resultant heap?
10, 7, 9, 8, 3, 1, 5, 2, 6, 4
10, 9, 8, 7, 6, 5, 4, 3, 2, 1
10, 9, 4, 5, 7, 6, 8, 2, 1, 3
10, 8, 6, 9, 7, 2, 3, 4, 1, 5
Question 7
A 3-ary max heap is like a binary max heap, but instead of 2 children, nodes have 3 children. A 3-ary heap can be represented by an array as follows: The root is stored in the first location, a[0], nodes in the next level, from left to right, is stored from a[1] to a[3]. The nodes from the second level of the tree from left to right are stored from a[4] location onward. An item x can be inserted into a 3-ary heap containing n items by placing x in the location a[n] and pushing it up the tree to satisfy the heap property. Which one of the following is a valid sequence of elements in an array representing 3-ary max heap?
1, 3, 5, 6, 8, 9
9, 6, 3, 1, 8, 5
9, 3, 6, 8, 5, 1
9, 5, 6, 8, 3, 1
Question 8
The elements 32, 15, 20, 30, 12, 25, 16 are inserted one by one in the given order into a Max Heap. The resultant Max Heap is.
a
b
c
d
Question 9
In a heap with n elements with the smallest element at the root, the 7th smallest element can be found in time
Θ(n log n)
Θ(n)
Θ(log n)
Θ(1)
Question 10
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
There are 18 questions to complete.