Lab 9 - Heapsort

Due: Wednesday at 5:00pm
This lab is worth 10 points.

There is no coding for this lab. As with Lab 7, turn in either an electronic or hand-written write-up. If electronic, make sure it is in plain text or PDF format.

Show how you would heapify then heapsort the following array: 17, 33, 3, 22, 45, 96, 42, 54, 15, 9 Show all steps.

For heapify, show where you would start testing for the heap property. Then for all nodes from the start back to the root, show how the heap property is restored if needed or write "OK" if that node satisfies the heap property. Show the resulting semi-heap after each step as either a drawn heap or as the array representation of the heap.

For heapsort, show the process of deleting each root node and show the contents of the array representation of the heap after deleting the root node. After the last step, the array should be sorted.