Class AVLTree<T extends Comparable<? super T>>
java.lang.Object
com.thomas.trees.BinarySearchTree<T>
com.thomas.trees.AVLTree<T>
- Type Parameters:
T- The type of the Node
A simple implenation of a AVL Tree
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBalances the node such that the balance factor is -1, 0, or 1intbalanceFactor(AVLNode<T> node) Calculates the balance factor of the nodeDeletes a value from a subtreevoidDeletes a value from the treeFinds the minimum node in the treevoidFixes the height of a nodeintGets the height of a nodeInserts a new value into a subtreevoidInserts a new value into the TreerotateLeft(AVLNode<T> node) Rotates the node leftrotateRight(AVLNode<T> node) Rotates the node rightMethods inherited from class BinarySearchTree
delete, find, find, findMin, getHeight, getRoot, getSize, in_order, in_order, insert, level_order, level_order, post_order, post_order, pre_order, pre_order, recursiveHeight, recursiveSize, removeMin, setRoot
-
Constructor Details
-
AVLTree
public AVLTree()Initializes an Empty AVL -
AVLTree
-
-
Method Details
-
balanceFactor
-
height
-
fixHeight
-
findMin
-
rotateRight
-
rotateLeft
-
balance
-
insert
Inserts a new value into the Tree- Overrides:
insertin classBinarySearchTree<T extends Comparable<? super T>>- Parameters:
value- The new data- See Also:
-
insert
-
delete
Deletes a value from the tree- Overrides:
deletein classBinarySearchTree<T extends Comparable<? super T>>- Parameters:
value- The value to be deleted- See Also:
-
delete
-