static void insert_case3(L_RBTREE *t, node *n) { if (node_color(uncle(n)) == L_RED_NODE) { n->parent->color = L_BLACK_NODE; uncle(n)->color = L_BLACK_NODE; grandparent(n)->color = L_RED_NODE; insert_case1(t, grandparent(n)); } else { insert_case4(t, n); } }
void insert_case3(rbtree t, node n) { if (node_color(uncle(n)) == RED) { n->parent->color = BLACK; uncle(n)->color = BLACK; grandparent(n)->color = RED; insert_case1(t, grandparent(n)); } else { insert_case4(t, n); } }
void insert_case3(rb_node* n, rb_tree* tree) { rb_node* u = uncle(n), *g; if ((u != NULL) && (u->color == RED)) { n->parent->color = BLACK; u->color = BLACK; g = grandparent(n); g->color = RED; insert_case1(g, tree); } else { insert_case4(n, tree); } }
static void insert_case3(struct RBTREE_TYPENAME* target, struct RBTREE_NODE* node) { struct RBTREE_NODE* U = uncle(node); struct RBTREE_NODE* G; DEBUG_RBTREE("insert_case3\n"); if (U != NULL && U->color == RED) { node->parent->color = BLACK; U->color = BLACK; G = grandparent(node); G->color = RED; insert_case1(target, G); } else { insert_case4(target, node); } }
/* * === FUNCTION ====================================================================== * Name: insert_case3 * Description: Covers the case that the parent and uncle are both RED * ===================================================================================== */ static void insert_case3 ( set * n ) { set * u = uncle(n); set * g; if((u != NULL ) && (u->color == RED)) { n->parent->color = BLACK; u->color = BLACK; g = grandparent(n); g->color = RED; insert_case1(g); } else { insert_case4(n); } } /* ----- end of static function insert_case3 ----- */