All Packages Class Hierarchy This Package Previous Next Index
Class DataStructures.AvlTree
java.lang.Object
|
+----DataStructures.AvlTree
- public class AvlTree
- extends Object
Implements an AVL tree.
Note that all "matching" is based on the compareTo method.
AvlTree()
- Construct the tree.
find(Comparable)
- Find an item in the tree.
findMax()
- Find the largest item in the tree.
findMin()
- Find the smallest item in the tree.
insert(Comparable)
- Insert into the tree; duplicates are ignored.
isEmpty()
- Test if the tree is logically empty.
main(String[])
-
makeEmpty()
- Make the tree logically empty.
printTree()
- Print the tree contents in sorted order.
remove(Comparable)
- Remove from the tree.
AvlTree
public AvlTree()
- Construct the tree.
insert
public void insert(Comparable x)
- Insert into the tree; duplicates are ignored.
- Parameters:
- x - the item to insert.
remove
public void remove(Comparable x)
- Remove from the tree. Nothing is done if x is not found.
- Parameters:
- x - the item to remove.
findMin
public Comparable findMin()
- Find the smallest item in the tree.
- Returns:
- smallest item or null if empty.
findMax
public Comparable findMax()
- Find the largest item in the tree.
- Returns:
- the largest item of null if empty.
find
public Comparable find(Comparable x)
- Find an item in the tree.
- Parameters:
- x - the item to search for.
- Returns:
- the matching item or null if not found.
makeEmpty
public void makeEmpty()
- Make the tree logically empty.
isEmpty
public boolean isEmpty()
- Test if the tree is logically empty.
- Returns:
- true if empty, false otherwise.
printTree
public void printTree()
- Print the tree contents in sorted order.
main
public static void main(String[] args)
All Packages Class Hierarchy This Package Previous Next Index