34 void (*DestFunc) (
void*),
35 void (*InfoDestFunc) (
void*),
36 void (*PrintFunc) (
const void*),
37 void (*PrintInfo)(
void*)) {
43 if (newTree->
nil) free (newTree->
nil);
210 if ( (y == tree->
root) ||
218 Assert(!tree->
nil->
red,
"nil not red in TreeInsertHelp");
319 if (nil != (y = x->
right)) {
320 while(y->
left != nil) {
326 while(x == y->
right) {
330 if (y == root)
return(nil);
354 if (nil != (y = x->
left)) {
355 while(y->
right != nil) {
361 while(x == y->
left) {
362 if (y == root)
return(nil);
388 if (x != tree->
nil) {
400 printf(
" red=%i\n",x->
red);
491 if (x == nil)
return(0);
493 while(0 != compVal) {
499 if ( x == nil)
return(0);
526 while( (!x->
red) && (root != x)) {
580 Assert(!tree->
nil->
red,
"nil not black in RBDeleteFixUp");
621 Assert( (y!=tree->
nil),
"y is nil in RBDelete\n");
682 while ( (lastBest != nil) && (1 != tree->
Compare(low,lastBest->
key))) {
686 return(enumResultStack);
void(* DestroyKey)(void *a)
struct rb_red_blk_node * parent
void RightRotate(rb_red_blk_tree *tree, rb_red_blk_node *y)
rb_red_blk_node * RBTreeInsert(rb_red_blk_tree *tree, void *key, void *info)
void TreeInsertHelp(rb_red_blk_tree *tree, rb_red_blk_node *z)
void StackPush(stk_stack *theStack, DATA_TYPE newInfoPointer)
void LeftRotate(rb_red_blk_tree *tree, rb_red_blk_node *x)
void(* PrintKey)(const void *a)
rb_red_blk_node * TreeSuccessor(rb_red_blk_tree *tree, rb_red_blk_node *x)
void Assert(int assertion, char *error)
int(* Compare)(const void *a, const void *b)
void RBDelete(rb_red_blk_tree *tree, rb_red_blk_node *z)
void(* DestroyInfo)(void *a)
stk_stack * RBEnumerate(rb_red_blk_tree *tree, void *low, void *high)
void RBDeleteFixUp(rb_red_blk_tree *tree, rb_red_blk_node *x)
if(aagss+aagstacksize-1<=aagssp)
void TreeDestHelper(rb_red_blk_tree *tree, rb_red_blk_node *x)
void InorderTreePrint(rb_red_blk_tree *tree, rb_red_blk_node *x)
rb_red_blk_tree * RBTreeCreate(int(*CompFunc)(const void *, const void *), void(*DestFunc)(void *), void(*InfoDestFunc)(void *), void(*PrintFunc)(const void *), void(*PrintInfo)(void *))
void RBTreePrint(rb_red_blk_tree *tree)
rb_red_blk_node * TreePredecessor(rb_red_blk_tree *tree, rb_red_blk_node *x)
void(* PrintInfo)(void *a)
void RBTreeDestroy(rb_red_blk_tree *tree)
rb_red_blk_node * RBExactQuery(rb_red_blk_tree *tree, void *q)
stk_stack * StackCreate()
struct rb_red_blk_node * right
struct rb_red_blk_node * left
void * SafeMalloc(size_t size)