Assignment 07: Heap Sort
For this assignment you will be using our class-built heap to implement the heap sort algorithm, making all necessary changes to the base class, while still maintaining its original functionality.
The Algorithm
Given an array A:={x∈Z∣−10,000≤x≤10,000}
def heapsort(A):
Heap h
for x in A:
h.push(x)
for i in range(0, len(A)):
A[i] = h.pop()
return
Instructions
This assignment will be hosted on Github Classroom.
- Register for the assignment on our Github Classroom using this link
- Be sure to select your name from the list to link your Github to the class roster!
- Clone the repository to your machine
- Open a terminal
- Navigate to your algorithms folder
- Go to the parent directory (
cd ..
)
- Clone the repository to this location (
git clone <your repository link here>
)
- Getting things in order
- Open your new folder in VS Code
- Begin by creating a new file
source/Sorts/heap.cpp
- Within this file, create the definition for your heap sort algorithm.
- Check that you can compile and run the unit tests for heap sort (
make heap
)
- Commit and push these changes (
git add . && git commit -m "<message>" && git push
)
- Check the online copy of your repository to make sure these changes were actually pushed
- Implement the Algorithm Commit and Push your work after each task
- Begin by creating pseudocode for the algorithm in the docstring
- Commit and push this pseudocode
- Implement your pseudocode in C++
- Pass all unit tests
- Commit and push your code.
- Analyze your work
- Determine the cost for each line in your algorithm
- Present your Best / Worst case analysis at the bottom of your docstring.
- Submit your work (
git add . && git commit -m "Done" && git push
)
Grading
Criteria |
Points |
Functional Correctness |
70 |
Analysis |
20 |
Quality |
10 |
Submission
Submissions are handled by Github Classroom.
Submissions after the deadline are not graded.