In this lab, you'll focus on three important skills:
- Understanding Binary Search Tree (BST) logic
- Code reading (being able to quickly understand another person's code)
- JavaDoc commenting (writing professional-style comments in code)
- Run LabRunner.java: Run the program and follow the output. Get a handle on what the program does.
- Improve the output of the BST's
toString()
function: Currently, when a BST is printed to the console, it displays only the root node. It would be helpful for the user to be able to see all nodes that are stored in the tree. Update thetoString()
method in the BinarySearchNode class to include all the nodes in the tree. Because it's a BST, it's easy for the list of all nodes to be provided to the user in sorted order, so ensure that the nodes are sorted. You may format the string representation of the BST however you like, so long as the new method is visually appealing and organized! - Comment The Code: You will find lots and lots of
// TODO:
statements scattered throughout this repository. Each of the// TODO:
statements asks you to leave a comment explaining what's going on in the code. You need to trace the code (use your IDE's debugger if it will help you), understand what the code does, and explain the code as you read it. - Enhance the
main
Function & Lab Runner: Add elements with keys that already exist. Search for elements in the tree that don't exist. Delete elements from the tree that don't exist. Update the printed results to be more human-readable and explanatory. - Ensure Your Code is Correctly Formatted: This is a step that you should ALWAYS complete before turning in any piece of code. Use your IDE's built-in code formatting function to ensure that your code is formatted according to (general) industry standards. In Eclipse, select
Source -> Format
or useCommand
+Shift
+F
. Do this for all 4 files in the repository (the BST, the BSN, the Runner, & the Person). - Submit Your Completed Lab: Commit, push, done!