Lab 8: The point of trees

Due Wednesday, April 9

Starting with the red/black tree demo from class, or (if you've finished it already) your project 2 AVL tree, convert your lab 3 to use a tree instead of a linked list. Since the tree should remain balanced, the search time for a word should be O(log(n)) instead of O(n) as it was in lab 3. Then, determine the amount of time taken to spell check a file with the original linked list solution compared to a tree solution. Make sure you time only the checking, not loading the dictionary!

Note that this still doesn't really address the problem of finding suggested alternatives for a given word. If you were going to offer suggestions with a tree-based approach, the last couple words checked when looking for a word can form a starting point.

It might occur to you that we're close to a solution for autocomplete. There's a related structure called a trie which can solve autocomplete more gracefully than a binary search tree. It's not part of the lab, but for further reading, consider the wikipedia page on the trie.