Assignment 06: Tree Sort
For this assignment you will be implementing and analyzing Tree Sort.
The Algorithm
Using a BST to sort an array of elements.
The steps to perform tree sort are:
- Insert all of the elements in the array into a BST
- Traverse the tree, placing each element back into the array in sorted order.
Input constraints:
Let [A = {x \in \mathbb{Z} | -10,000 \leq x \leq 10,000}].
Some pseudocode:
def treesort(A) -> None:
tree = BST()
for element in A:
tree.insert(element)
i = 0
for element in A.traverse():
A[i] = element
i += 1
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>
)
- Be sure to use the link for your copy of the repository for the assignment
- Getting things in order
- Open your new folder in VS Code
- Begin by creating a new file
source/Sorts/tree.cpp
- Within this file, create the definition for the sorting algorithm.
- Check that you can compile and run the unit tests for Tree Sort (
make tree
)
- Ensure that your code compiled, ran, and failed the unit tests.
- Commit and push your code
- Check the online copy of your repository to make sure your changes were pushed successfully
- Implement the algorithm Commit and Push your work after each task
- In the docstring for your function, write pseudocode to solve the problem
- Commit and push your pseudocode
- Implement the algorithm in C++
- Pass all unit tests
- Commit and push your work
- Analyze your work
- Proceed line by line, noting runtimes for each action
- Document your Best and Worst case analysis at the bottom of your docstring
- Submit your work
- Commit and push all code to your assignment repository.
Grading
Criteria |
Points |
Functionality |
70 |
Analysis |
20 |
Quality |
10 |
Submission
To submit this assignment, simply commit and push your work to your assignment repository.
Your last submission before the deadline will be graded.