Homework 7: Heaps
- Due before class on Friday, November 13
Remember to turn in a neat final draft of this homework on a separate sheet of paper.
- Write down the array that would be used to store the following heap:
- Draw the heap represented by the following array:
[null, 81, 64, 70, 40, 1, 48, 10, 30]
- Starting with the following array-based heap, show the resulting array
after performing the following series of insertions. You can show any of your
work, but be sure to clearly indicate
the array after each insertion.
1 2 3
insert(20) insert(60) insert(85)
[null, 82, 41, 79, 39, 15, 46, 49, 38]
- Starting with the following array-based heap, show the resulting
array after performing the following series of removals. You can show
any of your work, but be sure to
clearly indicate the array after each removal.
1 2 3
removeMax() removeMax() removeMax()
[null, 93, 63, 87, 50, 61, 78, 35, 38, 40, 6, 26]