Goals for this assignment are to:
Read Chapter 14.1 (pp 369-377)
Read through the heap code given in the text (chp 14.1) so that you understand what it is doing.
Beginning with your SortAnimation project from the earlier labs, complete the HeapSort.java code roughly basing it on the code in the text. You will need to do some modification so that it fits the SortAnimation program. For example, some of the differences are
Watch the animation - does it behave the way you expect?
HeapSort works by first building a heap. In order to see the heap's structure, add the following two functions (similar to what you wrote for the binary search tree):
Apply these two functions after the heap is created but before the sorting takes place. Print the results to the outTA textArea as shown in the image above. Note, the heap is displayed in 3 formats: 1) as an array, 2) in parenthesis notation, and 3) as tree on its side. Use this output to check that your heap code works, i.e. check that each node of your heap satisfies the heap property. Where is the largest item in the array?
By no later than Thursday Dec 6, you should zip together your project, including a jar files, and email the code as an attachment to gorr@willamette.edu. Place CS241 Lab 11 in the subject line.
Demonstrate your the heap animation before the end of the classes.