CS311 Project 2: An AVL-balanced Tree
Due Wednesday, April 3
Create an AVL-balanced binary tree ADT. This should be a template class, capable of holding any type of data that can be compared. You can assume that the comparison operators work for the data added to the tree (this is a common constraint for tree classes). The tree should support at least these methods:
- insert, which will insert a node into the tree
- remove, which will remove a node from the tree
- fetch, which will retrieve a reference to the data in a node. This will allow the user to change the data stored in the tree, for example, to update a count. Assume ordering for the tree will not be changed by this.
- contains, which will return true/false depending on if the indicated item is in the tree or not
- Some sort of display method which convincingly demonstrates that the tree is AVL-balanced after additions and deletions. I'd recommend retaining the graphviz solution that we'll use in class examples, but any solution is ok here.
Feel free to borrow any code you like from the class examples. Review the wikipedia page on AVL trees. It contains a number of examples which may be useful.