Question: Consider the following operations on an initially empty heap 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 h; this heap is a maxheap, so the biggest item is at the top. The heap is represented as a binary tree:
h.insert(3); h.insert(6); h.insert(2); h.insert(0); h.insert(10); h.insert(4); int item; h.remove(item); // Removes the biggest item from the heap, and puts it in item h.insert(9); h.insert(8); h.remove(item);
Show the resulting heap (As in problem 1a, show the tree in some recognizable form.)
Show how your heap from part a would be represented in an array.
After executing h.remove(item); one more time, show the array that results.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
