Homework 7: Simple Text Editor, part 4

Binary Search Tree

Read the partial implementation of BinarySearchTree.java. Much of the implementation is provided for you. Begin by completing the implementation of the contains() method. Then replace your hash table with a binary search tree and test your revised text editor. You can also test your binary search tree using BinarySearchTreeTester.java.

Some Suggestions

Next, we will add the capability of suggesting alternate words. One way to implement this is as follows. When the cursor is on a misspelled word, selecting the "suggestions" menu item pops up a dialog box with suggested alternatives. To implement this, complete the implementation of the successor() and predecessor() methods in the binary search tree class. When suggestions are requested, find the successor and predecessor of the word, and suggest both of them to the user. If one of them does not exist, make only one suggestion.

Restoring Balance

Add the capability for your tree to automatically rebalance itself after each addition of a word. For extra credit: