Question: Consider the following operations on an initially empty heap $mathrm{h}$; this heap is a maxheap, so the biggest item is at the top. The heap

 Consider the following operations on an initially empty heap $\mathrm{h}$; this

Consider the following operations on an initially empty heap $\mathrm{h}$; this heap is a maxheap, so the biggest item is at the top. The heap is represented as a binary tree: h.insert(5); h. insert(6); h.insert(0); h.insert(3); h.insert(10); h.insert(1); int item; h.remove(item); // Removes the biggest item from the heap, and puts it in item h.insert(9); h.insert(7); h.remove(item); a. Show the resulting heap (As in problem 1a, show the tree in some recognizable form.) b. Show how your heap from part a would be represented in an array. c. After executing $h$ remove $(i te m)$; one more time, show the array that results. CS.VS. 1153

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!