Tree Implementation Project

What is this project about?

Using everything you have learned so far with linear data structures and trees, implement an AVL tree. You should use an implementation of a BST as a starting point and then incorporate rotations and balancing. (hint: add a balancing factor and height instance variable to your list node class).

What do you need to implement?

AVLTree() -- Creates a new AVL Tree that is empty. It needs no parameters and returns an empty AVL Tree.

insert(item) -- Adds a new item to the tree in its appropriate spot. It needs the item and returns nothing.

delete(item) -- Removes the specified item from the tree and maintains AVL tree integrity. It needs the item and returns nothing. The tree is modified.

find(item) -- Tests to see if the specified item is in the tree. It needs the item and returns a boolean value.

isEmpty() -- Tests to see whether the AVL Tree is empty. It needs no parameters and returns a boolean value.

size() -- Returns the number of items on the AVL Tree. It needs no parameters and returns an integer.

toString() -- Returns a string of the AVL Tree, and it's contents, formatted as a list of pairs, in-order, top to bottom, left to right. For example: [(null, 55), (55, 49), (55, 76), (49, 1), (49, 53), (76, 56)]

Note: To make it more simple, your tree should not incorporate duplicates.

Full course
Next Lesson