#include <RedBlackTree.h>
Public Types | |
| enum | { RED, BLACK } |
| An emun to define valid RedBlackNode node colors. More... | |
Public Methods | |
| RedBlackTree (const Comparable &negInf) | |
| Construct the tree. | |
| RedBlackTree (const RedBlackTree &rhs) | |
| Copy constructor. | |
| ~RedBlackTree () | |
| Destructor for the tree. | |
| const Comparable & | findMin () const |
| Find the smallest item in the tree. | |
| const Comparable & | findMax () const |
| Find the largest item in the tree. | |
| const Comparable & | find (const Comparable &x) const |
| Find item x in the tree. | |
| bool | isEmpty () const |
| Test if the tree is logically empty. | |
| void | printTree () const |
| Print the AVL tree contents in sorted order. | |
| void | makeEmpty () |
| Make the tree logically empty. | |
| void | insert (const Comparable &x) |
| Insert x into the tree; duplicates are ignored. | |
| void | remove (const Comparable &x) |
| Remove x from the tree. | |
| const RedBlackTree & | operator= (const RedBlackTree &rhs) |
| Deep copy. | |
Note that all "matching" is based on the compares method.
|
|||||
|
An emun to define valid RedBlackNode node colors.
|
|
||||||||||
|
Construct the tree.
|
|
||||||||||
|
Copy constructor.
|
|
||||||||||
|
Find item x in the tree.
|
|
|||||||||
|
Find the largest item in the tree. Return the largest item of ITEM_NOT_FOUND if empty. |
|
|||||||||
|
Find the smallest item in the tree. Return smallest item or ITEM_NOT_FOUND if empty. |
|
||||||||||
|
Insert x into the tree; duplicates are ignored.
|
|
|||||||||
|
Test if the tree is logically empty.
|
|
||||||||||
|
Remove x from the tree. Nothing is done if x is not found.
|