Conclusion
Lab activities show that a BST not only supports the "standard" set of search structure operations (add, contains, remove). It can quickly perform several other related operations:
- the closest element in the tree to element n;
- the successor/predecessor of element n;
- the elements in the tree that are greater than n1 and less than n2;
- the kth element in the tree.
Thinking about how and why BSTs work the way they do is good practice, as are the tasks assigned for homework.
Homework Submission
- Complete the two exercises on the Homework slide.
- Submit your solutions in the files
BinaryTree.java
andBinaryTreeTest.java
ashw13
. BinaryTreeTest.java
should test the two new methods.- If you haven't already started, begin working on Project 2. Read the specifications thoroughly before starting to code.