Please make sure you adhere to the policies on academic honesty.
insert(12), insert(7), insert(14), insert(5), insert(20), insert(11), insert(6), insert(18), insert(8), insert(3), insert(17), insert(13), insert(4), insert(9).
Using Figure 7.3 as a guide for style, draw the heap which results at the very end of the last operation.
Note: for this problem we are not requiring you to show any of the work along the way, though you may if you wish. Please do be careful to follow the exact sequence given and to double-check your work.
index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Value | 3 | 6 | 9 | 12 | 8 | 18 | 11 | 20 | 13 | 17 | 24 | 23 | 22 | 15 | 26 | 21 | 25 | 27 | 16 |
Perform the following operations:
removeMin(), removeMin(), removeMin(), removeMin(), removeMin()For this problem, we want you to draw the five heaps which result at the end of each of the above operations. Your answers should also be drawn using the vector-based representation.
Note: in your own personal scratchwork, you might convert the heaps to the more natural tree representation, perform the operation, and then convert back to the vector in reporting your answer. However with a bit of practice, you should be able to perform the operations directly on the vector-based representation!