$30
CMPSC-132: Programming and Computation II
Lab #9
Read the instructions carefully before starting the assignment. Make sure your code follows the
stated guidelines to ensure full credit for your work.
Instructions:
- The work in this lab must be completed alone and must be your own.
- Download the starter code file from the LAB9 Assignment on Canvas. Do not change
the function names on your script.
- A doctest is provided as an example of code functionality. Getting the same result as the
doctest does not guarantee full credit. You are responsible for debugging and testing your
code with enough data, you can share ideas and testing code during your recitation class.
As a reminder, Gradescope should not be used to debug and test code!
- Each function must return the output (Do not use print in your final submission, otherwise
your submissions will receive a -1 point deduction)
- Do not include test code outside any function in the upload. Printing unwanted or illformatted data to output will cause the test cases to fail. Remove all your testing code
before uploading your file (You can also remove the doctest). Do not include the
input() function in your submission.
Goal
[10 pts] As discussed in our video lecture, heap sort is a comparison based sorting technique based
on the Binary Heap data structure. We could insert the items into a max heap and remove the root
node until the heap is empty, producing a sorted list. Using your code from LAB7, write the
function heapSort(numList) that takes a list of numbers and returnsthe final sorted list. List should
be sorted in ascending order
• You are not allowed to use the sorted() method or the sort operator. Your code will not get
credit if you use them
• You are not allowed to use the min() or max() built-in methods
• You are allowed to use built-in reverse methods
• You must use your code from LAB7
• heapSort must be outside the MaxPriorityQueue class
• If your code from LAB 7 is not working, is incomplete, or you did not submit it, you must
fixed it/complete it, otherwise code will not get full credit even if the heapSort code is
correct
Deliverables:
• Submit your code in a file name LAB9.py to the Lab9 GradeScope assignment before the
due date