static void delete_case2(L_RBTREE *t, node *n) { if (node_color(sibling(n)) == L_RED_NODE) { n->parent->color = L_RED_NODE; sibling(n)->color = L_BLACK_NODE; if (n == n->parent->left) rotate_left(t, n->parent); else rotate_right(t, n->parent); } delete_case3(t, n); }
void delete_case2(rbtree t, node n) { if (node_color(sibling(n)) == RED) { n->parent->color = RED; sibling(n)->color = BLACK; if (n == n->parent->left) rotate_left(t, n->parent); else rotate_right(t, n->parent); } delete_case3(t, n); }
void delete_case2(rb_node* n, rb_tree* tree) { rb_node* s = sibling(n); if (s->color == RED) { n->parent->color = RED; s->color = BLACK; if (n == n->parent->left) rotate_left(n->parent, tree); else rotate_right(n->parent, tree); } delete_case3(n, tree); }
void delete_case2(struct rbtree* tree, struct rbtree_node* node) { if(get_color(sibling(node)) == RB_RED) { node->parent->color = RB_RED; sibling(node)->color = RB_BLACK; if(node == node->parent->left) { rotate_left(node->parent,tree); } else { rotate_right(node->parent,tree); } } delete_case3(tree,node); }
static inline void delete_case2(struct RBTREE_TYPENAME* target, struct RBTREE_NODE* P, struct RBTREE_NODE* N) { struct RBTREE_NODE* S = sibling(P, N); if (S->color == RED) { P->color = RED; S->color = BLACK; if (N == P->left) rotate_left(target, P); else rotate_right(target, P); } delete_case3(target, N); }
//private function void Tree::delete_case2() { //so if our sibling is red we know the parent is black //then we can flip the colors and do a rotation to maintain //equal number of black nodes if(sibling()->red) { //create black node as the grandparent //which is the former sibling parent->red = true; sibling()->red = false; if(this == parent->left) rotate_left(parent); else rotate_right(parent); } //if its a black node we ignore keeping the invarient and go onto //the next case delete_case3(); }