Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

What shorter and longer-term career goals spark your interest?

Answered: 1 week ago