All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class DataStructures.AATree

java.lang.Object
   |
   +----DataStructures.AATree

public class AATree
extends java.lang.Object
implements DataStructures.SearchTree
Implements an AA-tree. Note that all "matching" is based on the compares method.


Constructor Index

 o AATree()
Construct the tree.

Method Index

 o find(Comparable)
Find an item in the tree.
 o findMax()
Find the largest item in the tree.
 o findMin()
Find the smallest item in the tree.
 o insert(Comparable)
Insert into the tree.
 o isEmpty()
Test if the tree is logically empty.
 o main(String[])
 o makeEmpty()
Make the tree logically empty.
 o printTree()
Print the tree contents in sorted order.
 o remove(Comparable)
Remove from the tree.
 o removeMin()
Remove the smallest item from the tree.

Constructors

 o AATree
 public AATree()
Construct the tree.

Methods

 o insert
 public void insert(Supporting.Comparable x) throws Exceptions.DuplicateItem
Insert into the tree.

Parameters:
x - the item to insert.
Throws: DuplicateItem
if an item that matches x is already in the tree.
 o remove
 public void remove(Supporting.Comparable x) throws Exceptions.ItemNotFound
Remove from the tree.

Parameters:
x - the item to remove.
Throws: ItemNotFound
if no item that matches x can be found in the tree.
 o removeMin
 public void removeMin() throws Exceptions.ItemNotFound
Remove the smallest item from the tree.

Throws: ItemNotFound
if the tree is empty.
 o findMin
 public Supporting.Comparable findMin() throws Exceptions.ItemNotFound
Find the smallest item in the tree.

Returns:
the smallest item.
Throws: ItemNotFound
if the tree is empty.
 o findMax
 public Supporting.Comparable findMax() throws Exceptions.ItemNotFound
Find the largest item in the tree.

Returns:
the largest item.
Throws: ItemNotFound
if the tree is empty.
 o find
 public Supporting.Comparable find(Supporting.Comparable x) throws Exceptions.ItemNotFound
Find an item in the tree.

Parameters:
x - the item to search for.
Returns:
the matching item.
Throws: ItemNotFound
if no item that matches x can be found in the tree.
 o makeEmpty
 public void makeEmpty()
Make the tree logically empty.

 o isEmpty
 public boolean isEmpty()
Test if the tree is logically empty.

Returns:
true if empty, false otherwise.
 o printTree
 public void printTree()
Print the tree contents in sorted order.

 o main
 public static void main(java.lang.String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index