Home | History | Annotate | Download | only in util

Lines Matching defs:BLACK

2  * rbtree.c -- generic red black tree
47 /** Node colour black */
48 #define BLACK 0
58 BLACK /* Color. */
72 * Creates a new red black tree, initializes and returns a pointer to it.
170 /* Paint the parent and the uncle black... */
171 node->parent->color = BLACK;
172 uncle->color = BLACK;
179 } else { /* Our uncle is black... */
186 node->parent->color = BLACK;
195 /* Paint the parent and the uncle black... */
196 node->parent->color = BLACK;
197 uncle->color = BLACK;
204 } else { /* Our uncle is black... */
211 node->parent->color = BLACK;
217 rbtree->root->color = BLACK;
222 * Inserts a node into a red black tree.
270 /* Fix up the red-black properties... */
277 * Searches the red black tree, returns the data if key is found or NULL otherwise.
389 /* if node is red then the child (black) can be swapped in */
393 /* change child to BLACK, removing a RED node is no problem */
394 if(child!=RBTREE_NULL) child->color = BLACK;
402 to_delete->color = BLACK;
412 /* determine sibling to the node that is one-black short */
420 /* removed parent==black from root, every path, so ok */
425 { /* rotate to get a black sibling */
427 sibling->color = BLACK;
436 if(child_parent->color == BLACK
437 && sibling->color == BLACK
438 && sibling->left->color == BLACK
439 && sibling->right->color == BLACK)
454 && sibling->color == BLACK
455 && sibling->left->color == BLACK
456 && sibling->right->color == BLACK)
461 child_parent->color = BLACK;
469 && sibling->color == BLACK
471 && sibling->left->color == BLACK)
474 sibling->right->color = BLACK;
481 && sibling->color == BLACK
483 && sibling->right->color == BLACK)
486 sibling->left->color = BLACK;
493 /* now we have a black sibling with a red child. rotate and exchange colors. */
495 child_parent->color = BLACK;
499 sibling->left->color = BLACK;
505 sibling->right->color = BLACK;
545 * Finds the first element in the red black tree