Practice: Binary Search Tree

The goal of this exercise is to understand the iterative and recursive implementations of binary search trees.

1. Set up

Get the starter code from ~tvandrun/Public/cs345/basicbst-given. Make a new project in Eclipse.

You can find a solution in ~tvandrun/Public/cs345/basicbst-soln.

2. The iterative version

In impl.IterativeBSTMap, complete the helper method findKey(). Several of the methods depend on this. Test using test.IBSTMTest

3. The recursive version

In impl.RecursiveBSTMap, complete the methods put(), containsKey(), and get() in the RealNode nested class. These will be pretty similar to each other. Test using test.RBSTMTest.


Thomas VanDrunen
Last modified: Fri Mar 15 14:34:20 CDT 2019