All Packages  Class Hierarchy  This Package  Previous  Next  Index  
Class DataStructures.RedBlackTree
java.lang.Object
    |
    +----DataStructures.RedBlackTree
- public class RedBlackTree
- extends Object- implements SearchTree
Implements a red black tree.
Note that all "matching" is based on the compares method.
 
 RedBlackTree(Comparable) RedBlackTree(Comparable)
- Construct the tree.
 
 find(Comparable) find(Comparable)
- Find an item in the tree.
 findMax() findMax()
- Find the largest item in the tree.
 findMin() findMin()
- Find the smallest item  the tree.
 insert(Comparable) insert(Comparable)
- Insert into the tree.
 isEmpty() isEmpty()
- Test if the tree is logically empty.
 main(String[]) main(String[])
- 
 makeEmpty() makeEmpty()
- Make the tree logically empty.
 printTree() printTree()
- Print the tree contents in sorted order.
 remove(Comparable) remove(Comparable)
- Remove from the tree.
 removeMin() removeMin()
- Remove the smallest item from the tree.
 
 RedBlackTree
RedBlackTree
public RedBlackTree(Comparable negInf)
- Construct the tree.
 
- 
- Parameters:
- negInf - a value less than or equal to all others.
 
 
 insert
insert
public void insert(Comparable x) throws DuplicateItem
- Insert into the tree.
 
- 
- Parameters:
- x - the item to insert.
- Throws:
DuplicateItem
- if an item
that matches x is already in the tree.
 
 remove
remove
public void remove(Comparable x) throws ItemNotFound
- Remove from the tree.
Not implemented in this version.
 
- 
- Parameters:
- x - the item to remove.
- Throws:
ItemNotFound
- if no item
that matches x can be found in the tree.
 
 removeMin
removeMin
public void removeMin() throws ItemNotFound
- Remove the smallest item from the tree.
Not implemented in this version.
 
- 
- Throws:
ItemNotFound
- if the tree is empty.
 
 findMin
findMin
public Comparable findMin() throws ItemNotFound
- Find the smallest item  the tree.
 
- 
- Returns:
- the smallest item.
- Throws:
ItemNotFound
- if the tree is empty.
 
 findMax
findMax
public Comparable findMax() throws ItemNotFound
- Find the largest item in the tree.
 
- 
- Returns:
- the largest item.
- Throws:
ItemNotFound
- if the tree is empty.
 
 find
find
public Comparable find(Comparable x) throws 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.
 
 makeEmpty
makeEmpty
public void makeEmpty()
- Make the tree logically empty.
 
 isEmpty
isEmpty
public boolean isEmpty()
- Test if the tree is logically empty.
 
- 
- Returns:
- true if empty, false otherwise.
 
 printTree
printTree
public void printTree()
- Print the tree contents in sorted order.
 
 main
main
public static void main(String[] args)
All Packages  Class Hierarchy  This Package  Previous  Next  Index