#include "CTBbtree.hxx"
Inheritance diagram for CTBbtree:


Public Methods | |
| CTBbtree () | |
| CTBbtree (const CTBbtree &rhs) | |
| virtual | ~CTBbtree () |
| CTBbtreeNode * | RNode () const |
| CTBbtreeNode * | First () const |
| CTBbtreeNode * | Last () const |
| CTBsize | Size () const |
| void | Clear () |
| void | TreeHeight (int &i_minh, int &i_maxh, float &f_avrp) const |
| bool | TreeCheck (ostream *p_os=0) const |
| void | Dump (int i_indent=0, ostream &os=cout, const char *p_text=0) const |
| CTBbtreeNode * | operator[] (CTBint i_ind) const |
| CTBbtree & | operator= (const CTBbtree &rhs) |
Private Attributes | |
| CTBbtreeNode * | mp_rnode |
| CTBbtreeNode * | mp_first |
| CTBbtreeNode * | mp_last |
| CTBint | mi_size |
Friends | |
| class | CTBbtreeNode |
The class CTBbtree implements together with CTBbtreeNode all the base functionality of a binary tree. Both classes are usually used as base classes for the implementation of associative containers, like CTBmap, but are also useful for the implementation of some types of queue containers.
The class pair CTBbtree and CTBbtreeNode implements AVL-Trees first proposed by Adel'son-Vel'skil and Landis and described in great detail in chapter 6.2.3 of Knuth Volume III. In particular, it uses for
Definition at line 20 of file CTBbtree.hxx.
|
|
Default constructor.
Definition at line 17 of file CTBbtree.icc. |
|
|
Copy constructor.
Definition at line 27 of file CTBbtree.icc. |
|
|
Definition at line 45 of file CTBbtree.cxx. |
|
|
Returns the root node.
Definition at line 39 of file CTBbtree.icc. Referenced by CTBmap::LocateMatchOrBound(), and CTBgset::LocateMatchOrBound().
|
|
|
Returns the first (left most) node.
Reimplemented in CTBgset, and CTBmap. Definition at line 47 of file CTBbtree.icc. Referenced by CTBmap::First(), and CTBgset::First().
|
|
|
Returns the last (right most) node.
Reimplemented in CTBgset, and CTBmap. Definition at line 55 of file CTBbtree.icc. Referenced by CTBmap::Last(), and CTBgset::Last().
|
|
|
Returns the number of nodes in the tree (see size).
Reimplemented in CTBgset, and CTBmap. Definition at line 63 of file CTBbtree.icc. Referenced by CTBmap::Size(), CTBgset::Size(), CTBmap::operator bool(), and CTBgset::operator bool().
|
|
|
Delete all nodes.
The Reimplemented in CTBgset, and CTBmap. Definition at line 60 of file CTBbtree.cxx. Referenced by CTBmap::Clear(), CTBgset::Clear(), operator=(), and ~CTBbtree().
|
|
||||||||||||||||||||||
|
Determine tree properties. Scans the tree and returns
Definition at line 132 of file CTBbtree.cxx. Referenced by Dump().
|
|
|
Check whether tree is balanced. Traverses the tree and checks whether it is balanced at each node and returns true if balanced and false in case of an imbalance. If p_os is non-null, an error message is written to p_os for each unbalanced node. Definition at line 157 of file CTBbtree.cxx. Referenced by Dump().
|
|
||||||||||||||||||||||
|
Dump tree structure. Dumps the tree header to os in the usual manner and prints in addition a one line summary for each node of the form:
rank lvl bc this up left right location
0 2 +l 804e670 804e648 - 804e710 l^
1 3 0r 804e710 804e670 - - Rl^
2 1 +^ 804e648 - 804e670 804e6c0 ^
3 3 0l 804e6e8 804e6c0 - - Lr^
4 2 +r 804e6c0 804e648 804e6e8 804e738 r^
5 4 0l 804e698 804e738 - - Lrr^
6 3 0r 804e738 804e6c0 804e698 804e760 rr^
7 4 0r 804e760 804e738 - - Rrr^
Reimplemented in CTBgset, and CTBmap. Definition at line 200 of file CTBbtree.cxx. Referenced by CTBmap::Dump(), and CTBgset::Dump().
|
|
|
Locate a node by rank.
Locates the node with rank i_ind and returns a pointer to this node or null if Definition at line 290 of file CTBbtree.cxx. |
|
|
Assignment operator.
The assignment operator is substantially faster than a node-by-node copy using
To `copy' a Definition at line 321 of file CTBbtree.cxx. Referenced by CTBbtree(), CTBmap::operator=(), and CTBgset::operator=().
|
|
|
Definition at line 22 of file CTBbtree.hxx. |
|
|
root node.
Definition at line 50 of file CTBbtree.hxx. |
|
|
first node.
Definition at line 51 of file CTBbtree.hxx. |
|
|
last node.
Definition at line 52 of file CTBbtree.hxx. |
|
|
number of nodes.
Definition at line 53 of file CTBbtree.hxx. |
1.2.9-20010812 written by Dimitri van Heesch,
© 1997-2001