|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weiss.nonstandard.RedBlackTree
Implements a red-black tree. Note that all "matching" is based on the compareTo method.
Constructor Summary | |
RedBlackTree()
Construct the tree. |
Method Summary | |
java.lang.Comparable |
find(java.lang.Comparable x)
Find an item in the tree. |
java.lang.Comparable |
findMax()
Find the largest item in the tree. |
java.lang.Comparable |
findMin()
Find the smallest item the tree. |
void |
insert(java.lang.Comparable item)
Insert into the tree. |
boolean |
isEmpty()
Test if the tree is logically empty. |
static void |
main(java.lang.String[] args)
|
void |
makeEmpty()
Make the tree logically empty. |
void |
printTree()
Print all items. |
void |
remove(java.lang.Comparable x)
Remove from the tree. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RedBlackTree()
Method Detail |
public void insert(java.lang.Comparable item)
item
- the item to insert.DuplicateItemException
- if item is already present.public void remove(java.lang.Comparable x)
x
- the item to remove.UnsupportedOperationException
- if called.public java.lang.Comparable findMin()
public java.lang.Comparable findMax()
public java.lang.Comparable find(java.lang.Comparable x)
x
- the item to search for.public void makeEmpty()
public void printTree()
public boolean isEmpty()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |