28 void (*DestFunc)(
void *)) {
33 if (newTree ==
NULL) {
111 assert(!
tree->nil->red &&
"nil not red in LeftRotate");
163 assert(!
tree->nil->red &&
"nil not red in RightRotate");
192 if (1 ==
tree->Compare(x->
key,
z->key)) {
199 if ( (y ==
tree->root) ||
200 (1 ==
tree->Compare(y->
key,
z->key))) {
206 assert(!
tree->nil->red &&
"nil not red in TreeInsertHelp");
278 tree->root->left->red=0;
301 if (nil != (y = x->
right)) {
302 while(y->
left != nil) {
308 while(x == y->
right) {
312 if (y == root)
return nil;
336 if (nil != (y = x->
left)) {
337 while(y->
right != nil) {
343 while(x == y->
left) {
344 if (y == root)
return nil;
416 if (x == nil)
return 0;
417 compVal =
tree->Compare(x->
key, q);
418 while(0 != compVal) {
424 if ( x == nil)
return 0;
425 compVal =
tree->Compare(x->
key, q);
451 while( (!x->
red) && (root != x)) {
504 assert(!
tree->nil->red &&
"nil not black in RBDeleteFixUp");
543 assert(y!=
tree->nil &&
"y is nil in RBDelete");
548 tree->DestroyKey(
z->key);
553 z->left->parent=
z->right->parent=y;
554 if (
z ==
z->parent->left) {
566 assert(!
tree->nil->red &&
"nil not black in RBDelete");
static node_list * newNode(Grid *g, Agnode_t *n, node_list *nxt)
void RBDelete(rb_red_blk_tree *tree, rb_red_blk_node *z)
rb_red_blk_node * TreePredecessor(rb_red_blk_tree *tree, rb_red_blk_node *x)
void RBTreeDestroy(rb_red_blk_tree *tree)
static void RightRotate(rb_red_blk_tree *tree, rb_red_blk_node *y)
rb_red_blk_node * RBExactQuery(rb_red_blk_tree *tree, void *q)
static void LeftRotate(rb_red_blk_tree *tree, rb_red_blk_node *x)
static void TreeDestHelper(rb_red_blk_tree *tree, rb_red_blk_node *x)
rb_red_blk_node * RBTreeInsert(rb_red_blk_tree *tree, void *key)
static void RBDeleteFixUp(rb_red_blk_tree *tree, rb_red_blk_node *x)
rb_red_blk_node * TreeSuccessor(rb_red_blk_tree *tree, rb_red_blk_node *x)
static void TreeInsertHelp(rb_red_blk_tree *tree, rb_red_blk_node *z)
rb_red_blk_tree * RBTreeCreate(int(*CompFunc)(const void *, const void *), void(*DestFunc)(void *))
struct rb_red_blk_node * right
struct rb_red_blk_node * parent
struct rb_red_blk_node * left
int(* Compare)(const void *a, const void *b)
void(* DestroyKey)(void *a)