public final class RedBlackTree<K extends java.lang.Comparable<K>>
extends java.lang.Object
Constructor and Description |
---|
RedBlackTree() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Remove all nodes from the tree.
|
boolean |
contains(K key)
Test if tree contains
key . |
void |
insert(K key) |
boolean |
isEmpty()
Test if the tree is logically empty.
|
void |
printTree() |
boolean |
remove(K key) |
K |
select(int i)
Select
i -th key in the tree (key with rank i ). |
int |
size() |
void |
verify() |
public void verify() throws java.lang.IllegalStateException
java.lang.IllegalStateException
public void clear()
public int size()
public void insert(K key)
public boolean remove(K key)
public K select(int i)
i
-th key in the tree (key with rank i
).i
- rank of the key to elect.i
.public boolean contains(K key)
key
.key
- the key to search for.public boolean isEmpty()
public void printTree()