Lab 10 - Heapsort

Due: 5:00pm on Wednesday

The purpose of this lab is to trace through the process of using heapsort on paper. We will be using max-heaps for this lab.

There is no coding for this lab. We will begin the lab with about 45 minutes of lecture on the nature of heaps and how to heapify a given array. After the lecture portion, show how you would heapify the following array: 17, 33, 3, 22, 45, 96, 42, 54, 15, 9

Show all steps. Work that does not show all steps will not get full credit. Show where you would start testing for the heap property (e.g. where you would start the "percolate down" routine) by circling or bolding the node. Then show how percolate down restores the heap property for that node. Show each swap needed in percolate down until the heap property is restored. Repeat this process with the next node, until you work your way back to the root. Either draw the heap or use the array representation of the heap to show how the heap is altered at each step.

Turn in either a hand-written or electronic writeup to receive credit for the lab.