Our next abstract data structure is the Binary Tree. For this homework assignment we are going to implement a Binary Search Tree to sort Contacts. This assignment should give you more practice with Eclipse and using a tree to store and sort information.
Section 6.5 Binary Search Trees has a very good write up of Binary Search Trees with code. Remember to give credit if you use the source code from the textbook.
This is where we will put all our classes for homework 10.
In this assignment you will implement a BinarySearchTree class, Contact class, ContactComparator, and use them to sort the Contacts.
Your ContactComparator must implement the Comparator interface to compare Contacts. It should sort by last name then first name. Your ContactComparator must pass the ContactComparatorTests.
The BinarySearchTree must:
Your BinarySearchTree needs to pass BinarySearchTreeTest.
Write up a runtime analysis of each of the use of a Binary Search Tree to sort, giving the big-O for sorting, and explaining how you got your results. Send your analysis to the TA together with your code. This part counts for 25% of the grade on this assignment. Even if your code doesn’t work, you should do this part to the best of your ability.
You must also build your own test code to make sure that your implementation works.
Please thoroughly test your code and briefly discuss your testing strategy. Turn in all test code.
Criterion | Excellent (100%) | Satisfactory (75%) | Borderline (50%) | Unsatisfactory (25%) | Poor (0) |
---|---|---|---|---|---|
Adherence to standards - 2 points Does it conform to standards in every detail? |
No errors. | Minor details of the assignment are violated, or poor choices are made where the assignment is unclear. | Significant details of the assignment or the underlying program intent are violated, but the program still fulfills essential functions. | Significant details of the assignment or the underlying program intent are violated, but the program still fulfills some essential functions. | Misses the point of the assignment. |
Breakdown (modular design) - 0.5 points Does it demonstrate good modular design? |
No errors. | 1-3 minor errors. | > 3 minor errors OR 1 major error. | 2 major errors | > 2 major error. |
Correctness of code - 2 points Does it work? Does it pass JUnit? |
Passes all tests. | Works for typical input, may fail for minor special cases. | Fails for typical input, for a minor reason. | Fails for typical input, for a major reason. | No. |
Documentation, and style - 2 points Is it clear and maintainable? Does it pass CheckStyle? |
No errors. | 1-3 minor errors. | > 3 minor errors OR 1 major error. | 2 major errors | > 2 major error. |
Efficiency of code - 1 point Does it use the Java features well? |
No errors. | 1-3 minor errors. | > 3 minor errors OR 1 major error. | 2 major errors | > 2 major error. |
Algorithm Analysis - 2.5 points |
The assignment is due on Friday at 11:55pm. You may turn it in early.