Back to the Lab Index

Lab 11 - More BST Mastery Exam Practice
Due: Wednesday, November 22st at 11:59PM

The Assignment

Your assignment for this week is to answer 3 more of the mastery exam questions for the BST section of the mastery exam. The three questions you will solve are: Below is the description of these three methods.

int maxLeafLevel()

Returns the level of the leaf that is farthest from the top (root) of the tree.

int minLeafLevel()

Returns the level of the leaf that is closest to the top (root) of the tree.

void printPath(Comparable keyItem)

Prints the value at each node between and including the root and the supplied keyItem. If the keyItem is not in the tree, then print nothing.

Testing

You will also have to write your own tester for this lab. Write a main method that will create certain BST's (hopefully some with edge cases contained in them) and will call on these methods to test them throughly. Below are the given Java files you need to get started. Make sure that your tester are HARD CODED. No user input. Also make sure to get all test cases, especially edge cases.

Files