Question: 1 6 1 4 1 0 8 9 7 6 5 1 2 1 1 4 3 7 . 4 3 . Answer the following

16
14
10
89
7
65
12
114
37.43. Answer the following questions based on this tree:
37. Write the complete binary tree as an array.
(a)1614121078965114
(b)1614121071148965
(c)1614108976512114
(d)8910657141141216
38. If the element 18 is added to the heap, what elements will it be swapped with to fix
the heap?
(a)11,12,16
(b)5,7,14,16
(c)11,12
(d)8,10,14
3
Name: 1 MULTIPLE CHOICE
39. If the heap is popped, which element will be removed and returned?
(a)16
(b)8
(c)5
(d)4
40. If the heap is popped, which swaps will happen to fix the heap?
(a)16->5,5->12->4
(b)16->14->10->9
(c)16->5,5->14->10->9
(d)16->12->11
41. How long does it take to add an element to a heap?
(a) O(log n)
(b) O(n
2
)
(c) O(1)
(d) O(n log n)
(e) O(n)
42. How long does it take to access the maximum element in a heap?
(a) O(log n)
(b) O(n
2
)
(c) O(1)
(d) O(n log n)
(e) O(n)
43. How long does it take to pop a heap?
(a) O(log n)
(b) O(n
2
)
(c) O(1)
(d) O(n log n)
(e) O(n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!