|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweiss.nonstandard.RedBlackTree<AnyType>
public class RedBlackTree<AnyType extends java.lang.Comparable<? super AnyType>>
Implements a red-black tree. Note that all "matching" is based on the compareTo method.
Constructor Summary | |
---|---|
RedBlackTree()
Construct the tree. |
Method Summary | |
---|---|
AnyType |
find(AnyType x)
Find an item in the tree. |
AnyType |
findMax()
Find the largest item in the tree. |
AnyType |
findMin()
Find the smallest item the tree. |
void |
insert(AnyType 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(AnyType 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(AnyType item)
item
- the item to insert.
DuplicateItemException
- if item is already present.public void remove(AnyType x)
x
- the item to remove.
java.lang.UnsupportedOperationException
- if called.public AnyType findMin()
public AnyType findMax()
public AnyType find(AnyType 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: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |