BFLibCPP 0.1
CPP Library
|
#include <rbtree.hpp>
Classes | |
class | Iterator |
class | RBNode |
class | RBNodeNonnull |
class | RBNodeNull |
Public Member Functions | |
RBTree () | |
virtual | ~RBTree () |
virtual const RBNode * | root () const |
virtual const RBNode * | getNodeForObject (T obj) |
virtual int | insert (T obj) |
virtual int | remove (T obj) |
virtual void | print () |
virtual void | print (bool printNullNodes) |
int | deleteNode (const RBNode *node) |
virtual const RBNode * | minNode () const |
virtual const RBNode * | maxNode () const |
virtual int | createIterator (Iterator **itr) |
![]() | |
BinTree () | |
virtual | ~BinTree () |
void | setCompareCallback (int(*cb)(T a, T b)) |
int | insert (T obj) |
int | count () const |
bool | contains (T obj) |
T | max () const |
T | min () const |
virtual int | deleteNode (BinNode *node) |
int | removeAll () |
int | leafValues (List< T > *list) |
virtual int | createIterator (Iterator **itr) |
int | runCompare (T a, T b) const |
![]() | |
Object () | |
Object (Object &obj) | |
virtual | ~Object () |
Additional Inherited Members | |
![]() | |
static void | retain (Object *obj) |
static void | release (Object *obj) |
static int | retainCount (Object *obj) |
static int | retainCount (Object &obj) |
![]() | |
virtual int | insert (BinNode *newNode, BinNode *parent) |
virtual void | print (BinNode *node) |
virtual const BinNode * | minNode (const BinNode *node) const |
Returns the leaf node | |
virtual const BinNode * | maxNode (const BinNode *node) const |
Returns the leaf node | |
BinNode * | getNodeForObject (T obj, BinNode *node) |
BinNode ** | rootAddr () |
Root accessors. | |
void | setRoot (BinNode *node) |
BinNode ** | getNodeLocation (const BinNode *node) |
void | setNodeLocation (BinNode *node, BinNode **location) |
BinNode * | getNodeParent (const BinNode *node) |
void | setNodeParent (BinNode *node, BinNode *parent) |
virtual bool | canNewNodeTakeNewLocation (BinNode **newLocation) |
virtual int | replaceNodeWithTheOnlyChild (BinNode *node) |
virtual int | replaceNodeWithNode (BinNode *node, BinNode *replacement) |
int | removeNode (BinNode *node) |
![]() | |
int | _count |
Red Black Binary Tree
Left most node is the least value comparison
|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
Removes node from tree and deletes the memory
This is was made so that caller does not have to cast RBNode to BinNode
|
inlinevirtual |
Returns nonnull pointer to BinNode
Returns NULL if node with obj could not be found
Caller does not own node
Reimplemented from BF::BinTree< T, int >.
|
inlinevirtual |
inserts object into tree
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Prints tree with root at the left most positions and the leafs at the right most, start from the top the right leaves
Reimplemented from BF::BinTree< T, int >.
|
inlinevirtual |
param printNullNodes
: If true, then null nodes will be shown
|
inlinevirtual |
Removes object from tree
refs: https://www.geeksforgeeks.org/red-black-tree-set-3-delete-2/
notes: When a black node is deleted and replaced by a black child, the child is marked as double black
Reimplemented from BF::BinTree< T, int >.
|
inlinevirtual |