当前位置: 首页>>代码示例>>C++>>正文


C++ LeftRotate函数代码示例

本文整理汇总了C++中LeftRotate函数的典型用法代码示例。如果您正苦于以下问题:C++ LeftRotate函数的具体用法?C++ LeftRotate怎么用?C++ LeftRotate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LeftRotate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IntervalTreeNode

IntervalTreeNode * IntervalTree::Insert(Interval * newInterval)
{
  IntervalTreeNode * y;
  IntervalTreeNode * x;
  IntervalTreeNode * newNode;

  x = new IntervalTreeNode(newInterval);
  TreeInsertHelp(x);
  FixUpMaxHigh(x->parent);
  newNode = x;
  x->red=1;
  while(x->parent->red) { /* use sentinel instead of checking for root */
    if (x->parent == x->parent->parent->left) {
      y=x->parent->parent->right;
      if (y->red) {
	x->parent->red=0;
	y->red=0;
	x->parent->parent->red=1;
	x=x->parent->parent;
      } else {
	if (x == x->parent->right) {
	  x=x->parent;
	  LeftRotate(x);
	}
	x->parent->red=0;
	x->parent->parent->red=1;
	RightRotate(x->parent->parent);
      }
    } else { /* case for x->parent == x->parent->parent->right */
             /* this part is just like the section above with */
             /* left and right interchanged */
      y=x->parent->parent->left;
      if (y->red) {
	x->parent->red=0;
	y->red=0;
	x->parent->parent->red=1;
	x=x->parent->parent;
      } else {
	if (x == x->parent->left) {
	  x=x->parent;
	  RightRotate(x);
	}
	x->parent->red=0;
	x->parent->parent->red=1;
	LeftRotate(x->parent->parent);
      }
    }
  }
  root->left->red=0;
  return(newNode);

#ifdef CHECK_INTERVAL_TREE_ASSUMPTIONS
  CheckAssumptions();
#elif defined(DEBUG_ASSERT)
  Assert(!nil->red,"nil not red in ITTreeInsert");
  Assert(!root->red,"root not red in ITTreeInsert");
  Assert((nil->maxHigh=MIN_INT),
	 "nil->maxHigh != MIN_INT in ITTreeInsert");
#endif
}
开发者ID:gpertea,项目名称:gsrc,代码行数:60,代码来源:GIntervalTree.cpp

示例2: InsertImpl

typename Map<K,V,KeyElementTraits, ValueElementTraits, ThreadingModel>::Node* Map<K,V,KeyElementTraits, ValueElementTraits, ThreadingModel>::Insert( CONST K& Key, CONST V& Value )
{
	Node* pNewNode = InsertImpl( Key, Value );

	Node* pX = pNewNode;
	pX->m_Status = Node::Red;
	Node* pY = 0;
	while (pX != m_pRoot && pX->m_pParent->m_Status == Node::Red)
	{
		if (pX->m_pParent == pX->m_pParent->m_pParent->m_pLeft)
		{
			pY = pX->m_pParent->m_pParent->m_pRight;
			if (pY != NULL && pY->m_Status == Node::Black)
			{
				pX->m_pParent->m_Status = Node::Black;
				pY->m_Status = Node::Black;
				pX->m_pParent->m_pParent->m_Status = Node::Red;
				pX = pX->m_pParent->m_pParent;
			}
			else
			{
				if (pX == pX->m_pParent->m_pRight)
				{
					pX = pX->m_pParent;
					LeftRotate(pX);
				}
				pX->m_pParent->m_Status = Node::Black;
				pX->m_pParent->m_pParent->m_Status = Node::Red;
				RightRotate(pX->m_pParent->m_pParent);
			}
		}
		else
		{
			pY = pX->m_pParent->m_pParent->m_pLeft;
			if (pY != NULL && pY->m_Status == Node::Red)
			{
				pX->m_pParent->m_Status = Node::Black;
				pY->m_Status = Node::Black;
				pX->m_pParent->m_pParent->m_Status = Node::Red;
				pX = pX->m_pParent->m_pParent;
			}
			else
			{
				if (pX == pX->m_pParent->m_pLeft)
				{
					pX = pX->m_pParent;
					RightRotate(pX);
				}
				pX->m_pParent->m_Status = Node::Black;
				pX->m_pParent->m_pParent->m_Status = Node::Red;
				LeftRotate(pX->m_pParent->m_pParent);
			}
		}
	}

	m_pRoot->m_Status = Node::Black;
	SetNil(&m_pRoot->m_pParent);

	return pNewNode;
}
开发者ID:anareboucas,项目名称:nanook,代码行数:60,代码来源:MapImpl.hpp

示例3: InsertImpl

typename Set<K,ElementTraits>::Node* Set<K,ElementTraits>::Insert( CONST K& Key )
{
	Node* pNewNode = InsertImpl( Key );

	Node* pX = pNewNode;
	pX->m_Status = Node::Red;
	Node* pY = 0;
	while (pX != m_pRoot && pX->m_pParent->m_Status == Node::Red)
	{
		if (pX->m_pParent == pX->m_pParent->m_pParent->m_pLeft)
		{
			pY = pX->m_pParent->m_pParent->m_pRight;
			if (pY != NULL && pY->m_Status == Node::Black)
			{
				pX->m_pParent->m_Status = Node::Black;
				pY->m_Status = Node::Black;
				pX->m_pParent->m_pParent->m_Status = Node::Red;
				pX = pX->m_pParent->m_pParent;
			}
			else
			{
				if (pX == pX->m_pParent->m_pRight)
				{
					pX = pX->m_pParent;
					LeftRotate(pX);
				}
				pX->m_pParent->m_Status = Node::Black;
				pX->m_pParent->m_pParent->m_Status = Node::Red;
				RightRotate(pX->m_pParent->m_pParent);
			}
		}
		else
		{
			pY = pX->m_pParent->m_pParent->m_pLeft;
			if (pY != NULL && pY->m_Status == Node::Red)
			{
				pX->m_pParent->m_Status = Node::Black;
				pY->m_Status = Node::Black;
				pX->m_pParent->m_pParent->m_Status = Node::Red;
				pX = pX->m_pParent->m_pParent;
			}
			else
			{
				if (pX == pX->m_pParent->m_pLeft)
				{
					pX = pX->m_pParent;
					RightRotate(pX);
				}
				pX->m_pParent->m_Status = Node::Black;
				pX->m_pParent->m_pParent->m_Status = Node::Red;
				LeftRotate(pX->m_pParent->m_pParent);
			}
		}
	}

	m_pRoot->m_Status = Node::Black;
	SetNil(&m_pRoot->m_pParent);

	return pNewNode;
}
开发者ID:anareboucas,项目名称:nanook,代码行数:60,代码来源:SetImpl.hpp

示例4: IT_insert

IntervalTreeNode *
IT_insert(IntervalTree *it, long low, long high, void *data)
{
    IntervalTreeNode *x, *y, *newNode;

    x = ITN_create(low, high, data);
    TreeInsertHelp(it, x);
    FixUpMaxHigh(it, x->parent);
    newNode = x;
    x->red=1;
    while(x->parent->red) { /* use sentinel instead of checking for root */
        if (x->parent == x->parent->parent->left) {
            y=x->parent->parent->right;
            if (y->red) {
                x->parent->red=0;
                y->red=0;
                x->parent->parent->red=1;
                x=x->parent->parent;
            } else {
                if (x == x->parent->right) {
                    x=x->parent;
                    LeftRotate(it, x);
                }
                x->parent->red=0;
                x->parent->parent->red=1;
                RightRotate(it, x->parent->parent);
            } 
        } else { /* case for x->parent == x->parent->parent->right */
             /* this part is just like the section above with */
             /* left and right interchanged */
            y=x->parent->parent->left;
            if (y->red) {
                x->parent->red=0;
                y->red=0;
                x->parent->parent->red=1;
                x=x->parent->parent;
            } else {
                if (x == x->parent->left) {
                    x=x->parent;
                    RightRotate(it, x);
                }
                x->parent->red=0;
                x->parent->parent->red=1;
                LeftRotate(it, x->parent->parent);
            } 
        }
    }
    it->root->left->red=0;

#ifdef CHECK_INTERVAL_TREE_ASSUMPTIONS
    IT_CheckAssumptions(it);
#elif defined(DEBUG_ASSERT)
    Assert(!it->nil->red,"nil not red in ITTreeInsert");
    Assert(!it->root->red,"root not red in ITTreeInsert");
    Assert((it->nil->maxHigh=LONG_MIN),
           "nil->maxHigh != LONG_MIN in ITTreeInsert");
#endif
    return newNode;
}
开发者ID:Acidburn0zzz,项目名称:yasm,代码行数:59,代码来源:inttree.c

示例5: RbTreeInsert

RBNODE
RbTreeInsert (RBTREE tree, RBKEY key, RBVALUE info)
{
  RBNODE y;
  RBNODE x;
  RBNODE newNode;

  ++tree->count;
  x=(RBNODE) SafeMalloc(sizeof(*x));
  x->key=key;
  x->info=info;

  TreeInsertHelp(tree,x);
  newNode=x;
  x->red=1;
  while(x->parent->red) { /* use sentinel instead of checking for root */
    if (x->parent == x->parent->parent->left) {
      y=x->parent->parent->right;
      if (y->red) {
	x->parent->red=0;
	y->red=0;
	x->parent->parent->red=1;
	x=x->parent->parent;
      } else {
	if (x == x->parent->right) {
	  x=x->parent;
	  LeftRotate(tree,x);
	}
	x->parent->red=0;
	x->parent->parent->red=1;
	RightRotate(tree,x->parent->parent);
      } 
    } else { /* case for x->parent == x->parent->parent->right */
      y=x->parent->parent->left;
      if (y->red) {
	x->parent->red=0;
	y->red=0;
	x->parent->parent->red=1;
	x=x->parent->parent;
      } else {
	if (x == x->parent->left) {
	  x=x->parent;
	  RightRotate(tree,x);
	}
	x->parent->red=0;
	x->parent->parent->red=1;
	LeftRotate(tree,x->parent->parent);
      } 
    }
  }
  tree->root->left->red=0;
  return(newNode);

#ifdef DEBUG_ASSERT
  Assert(!tree->nil->red,"nil not red in RbTreeInsert");
  Assert(!tree->root->red,"root not red in RbTreeInsert");
#endif
}
开发者ID:MarcNo,项目名称:lifelines,代码行数:58,代码来源:rbtree.c

示例6: RBTreeInsert

rb_red_blk_node * RBTreeInsert(rb_red_blk_tree* tree, void* key, void* info) {
  rb_red_blk_node * y;
  rb_red_blk_node * x;
  rb_red_blk_node * newNode;

  if (setjmp(rb_jbuf))
    return NULL;
  x=(rb_red_blk_node*) SafeMalloc(sizeof(rb_red_blk_node));
  x->key=key;
  x->info=info;

  TreeInsertHelp(tree,x);
  newNode=x;
  x->red=1;
  while(x->parent->red) { /* use sentinel instead of checking for root */
    if (x->parent == x->parent->parent->left) {
      y=x->parent->parent->right;
      if (y->red) {
	x->parent->red=0;
	y->red=0;
	x->parent->parent->red=1;
	x=x->parent->parent;
      } else {
	if (x == x->parent->right) {
	  x=x->parent;
	  LeftRotate(tree,x);
	}
	x->parent->red=0;
	x->parent->parent->red=1;
	RightRotate(tree,x->parent->parent);
      } 
    } else { /* case for x->parent == x->parent->parent->right */
      y=x->parent->parent->left;
      if (y->red) {
	x->parent->red=0;
	y->red=0;
	x->parent->parent->red=1;
	x=x->parent->parent;
      } else {
	if (x == x->parent->left) {
	  x=x->parent;
	  RightRotate(tree,x);
	}
	x->parent->red=0;
	x->parent->parent->red=1;
	LeftRotate(tree,x->parent->parent);
      } 
    }
  }
  tree->root->left->red=0;
  return(newNode);

#ifdef DEBUG_ASSERT
  Assert(!tree->nil->red,"nil not red in RBTreeInsert");
  Assert(!tree->root->red,"root not red in RBTreeInsert");
#endif
}
开发者ID:TidyHuang,项目名称:vizgems,代码行数:57,代码来源:red_black_tree.c

示例7: RBDeleteFixUp

void RBDeleteFixUp(rb_red_blk_node* x) {
  rb_red_blk_node* root=tree->root->left;
  rb_red_blk_node* w;

  while( (!x->red) && (root != x)) {
    if (x == x->parent->left) {
      w=x->parent->right;
      if (w->red) {
	w->red=0;
	x->parent->red=1;
	LeftRotate(x->parent);
	w=x->parent->right;
      }
/* XXX: original code was :       if ( (!w->right->red) && (!w->left->red) ) {  */
      if ( false &&  (!w->right->red) && (!w->left->red) ) { 
	w->red=1;
	x=x->parent;
      } else {
	if (!w->right->red) {
	  w->left->red=0;
	  w->red=1;
	  RightRotate(w);
	  w=x->parent->right;
	}
	w->red=x->parent->red;
	x->parent->red=0;
	w->right->red=0;
	LeftRotate(x->parent);
	x=root;       }
    } else {       w=x->parent->left;
      if (w->red) {
	w->red=0;
	x->parent->red=1;
	RightRotate(x->parent);
	w=x->parent->left;
      }
      if ( (!w->right->red) && (!w->left->red) ) { 
	w->red=1;
	x=x->parent;
      } else {
	if (!w->left->red) {
	  w->right->red=0;
	  w->red=1;
	  LeftRotate(w);
	  w=x->parent->left;
	}
	w->red=x->parent->red;
	x->parent->red=0;
	w->left->red=0;
	RightRotate(x->parent);
	x=root;       }
    }
  }
  x->red=0;
}
开发者ID:jonahkall,项目名称:blt,代码行数:55,代码来源:rbtree592.cpp

示例8: while

void RbTree<Type>::DeleteFixup(TreeNodePointer nodepointer) {
    while (nodepointer!=&m_nil && nodepointer->m_color==BLACK) {
        if (nodepointer = nodepointer->m_parent->m_left) {
            TreeNodePointer brothernode = nodepointer->m_parent->m_right;
            if (brothernode->m_color == RED) {
                brothernode->m_color = BLACK;
                nodepointer->m_parent->m_color = RED;
                LeftRotate(nodepointer->m_parent);
                brothernode = nodepointer->m_parent->m_right;
            }
            if (brothernode->m_left->m_color == BLACK && brothernode->m_right->m_color == BLACK) {
                brothernode->m_color = RED;
                nodepointer = nodepointer->m_parent;
            } else { 
                if (brothernode->m_right->m_color == BLACK) {
                    brothernode->m_left->m_color = BLACK;
                    brothernode->m_color = RED;
                    RightRotate(brothernode);
                    brothernode = nodepointer->m_parent->m_right;
                }
                brothernode->m_color = nodepointer->m_parent->m_color;
                nodepointer->m_parent->m_color = BLACK;
                brothernode->m_right->m_color = BLACK;
                LeftRotate(nodepointer->m_parent);
                nodepointer = m_root;
            }
        }else {
            TreeNodePointer brothernode = nodepointer->m_left;
            if (brothernode->m_color == RED) {
                brothernode->m_color = BLACK;
                nodepointer->m_parent->m_color = RED;
                RightRotate(nodepointer->m_parent);
                brothernode = nodepointer->m_parent->m_left;
            }
            if (brothernode->m_left->m_color == BLACK && brothernode->m_right->m_color == BLACK) {
                brothernode->m_color = RED;
                nodepointer = nodepointer->m_parent;
            } else {
                if (brothernode->m_left->m_color == BLACK) {
                    brothernode->m_right->m_color = BLACK;
                    brothernode->m_color = RED;
                    LeftRotate(brothernode);
                    brothernode = nodepointer->m_parent->m_left;
                }
                brothernode->m_color = nodepointer->m_parent->m_color;
                nodepointer->m_parent->m_color = BLACK;
                brothernode->m_left->m_color = BLACK;
                RightRotate(nodepointer->m_parent);
                nodepointer = m_root;
            }
        }
    }
    nodepointer->m_color = BLACK;    
}
开发者ID:magicdog,项目名称:algorithm,代码行数:54,代码来源:rbtree.cpp

示例9: while

void RBTree::InsertFixup(rb_node_t *z)
{
    rb_node_t *y;

    while(p_of(z)->color == RED) {
        if (p_of(z) == pp_of(z)->left) {
            y = pp_of(z)->right;        // uncle
            if (y->color == RED) {
                // case 1: uncle is red
                p_of(z)->color = BLACK;
                y->color = BLACK;
                pp_of(z)->color = RED;
                z = pp_of(z);
            } else {
                if (z == p_of(z)->right) {
                    // case2: uncle is black and z is right child
                    z = p_of(z);
                    LeftRotate(z);
                }
                // case3: uncle is black and z is left child
                p_of(z)->color = BLACK;
                pp_of(z)->color = RED;
                RightRotate(pp_of(z));
            }

        } else if (p_of(z) == pp_of(z)->right) {
            y = pp_of(z)->left;
            if (y->color == RED) {
                p_of(z)->color = BLACK;
                y->color = BLACK;
                pp_of(z)->color = RED;
                z = pp_of(z);
            } else {
                if (z == p_of(z)->left) {
                    z = p_of(z);
                    RightRotate(z);
                }

                p_of(z)->color = BLACK;
                pp_of(z)->color = RED;
                LeftRotate(pp_of(z));
            }

        }
    }
    this->root->color = BLACK;
}
开发者ID:gccli,项目名称:mylibrary,代码行数:47,代码来源:rbtree.cpp

示例10: TreeInsertHelp

void RBTree::RBTreeInsert(int key) {
  rb_red_blk_node * y;
  rb_red_blk_node * x;
  rb_red_blk_node * newNode;

  x=new rb_red_blk_node;
  x->key=key;

  TreeInsertHelp(x);
  newNode=x;
  x->red=1;
  while(x->parent->red) {     if (x->parent == x->parent->parent->left) {
      y=x->parent->parent->right;
      if (y->red) {
	x->parent->red=0;
	y->red=0;
	x->parent->parent->red=1;
	x=x->parent->parent;
      } else {
/* XXX: original code was : 	if (x == x->parent->right) { */
	if (x  >  x->parent->right) {
	  x=x->parent;
	  LeftRotate(x);
	}
	x->parent->red=0;
	x->parent->parent->red=1;
	RightRotate(x->parent->parent);
      } 
    } else {       y=x->parent->parent->left;
      if (y->red) {
	x->parent->red=0;
	y->red=0;
	x->parent->parent->red=1;
	x=x->parent->parent;
      } else {
	if (x == x->parent->left) {
	  x=x->parent;
	  RightRotate(x);
	}
	x->parent->red=0;
	x->parent->parent->red=1;
	LeftRotate(x->parent->parent);
      } 
    }
  }
  tree->root->left->red=0;
}
开发者ID:jonahkall,项目名称:blt,代码行数:47,代码来源:rbtree337.cpp

示例11: insertFixup

void insertFixup(BRTree * T, BRNode * z) {
    if (z->p == NULL) {
        z->color = BLACK;
        return;
    }
    if (z->p->p == NULL) {
        return;
    }
    BRNode * y;
    while(z->p != NULL && z->p->color == RED) {
        if(z->p == z->p->p->left) {
            y = z->p->p->right;
            if(y != NULL && y->color == RED) {
                z->p->color = BLACK;
                y->color = BLACK;
                z->p->p->color = RED;
                z = z->p->p;
            } else {
                if(z == z->p->right) {
                    z = z->p;
                    LeftRotate(T, z);
                }
                z->p->color = BLACK;
                z->p->p->color = RED;
                RightRotate(T, z->p->p);
            }
        } else {
            y = z->p->p->left;
            if(y != NULL && y->color == RED) {
                z->p->color = BLACK;
                y->color = BLACK;
                z->p->p->color = RED;
                z = z->p->p;
            } else {
                if(z == z->p->left) {
                    z = z->p;
                    RightRotate(T,z);
                }
                z->p->color = BLACK;
                z->p->p->color = RED;
                LeftRotate(T, z->p->p);
            }
        }
    }
    T->root->color = BLACK;
}
开发者ID:komea,项目名称:leetcode,代码行数:46,代码来源:220-Contains+Duplicate+III.c

示例12: Camellia_DecryptBlock_Rounds

void Camellia_DecryptBlock_Rounds(int grandRounds, const u8 ciphertext[],
                                  const KEY_TABLE_TYPE keyTable,
                                  u8 plaintext[])
{
    u32 s0, s1, s2, s3;
    const u32 *k = keyTable + grandRounds * 16, *kend = keyTable + 4;

    s0 = GETU32(ciphertext) ^ k[0];
    s1 = GETU32(ciphertext + 4) ^ k[1];
    s2 = GETU32(ciphertext + 8) ^ k[2];
    s3 = GETU32(ciphertext + 12) ^ k[3];

    while (1) {
        /* Camellia makes 6 Feistel rounds */
        k -= 12;
        Camellia_Feistel(s0, s1, s2, s3, k + 10);
        Camellia_Feistel(s2, s3, s0, s1, k + 8);
        Camellia_Feistel(s0, s1, s2, s3, k + 6);
        Camellia_Feistel(s2, s3, s0, s1, k + 4);
        Camellia_Feistel(s0, s1, s2, s3, k + 2);
        Camellia_Feistel(s2, s3, s0, s1, k + 0);

        if (k == kend)
            break;

        /*
         * This is the same function as the diffusion function D of the
         * accompanying documentation. See section 3.2 for properties of the
         * FLlayer function.
         */
        k -= 4;
        s1 ^= LeftRotate(s0 & k[2], 1);
        s2 ^= s3 | k[1];
        s0 ^= s1 | k[3];
        s3 ^= LeftRotate(s2 & k[0], 1);
    }

    k -= 4;
    s2 ^= k[0], s3 ^= k[1], s0 ^= k[2], s1 ^= k[3];

    PUTU32(plaintext, s2);
    PUTU32(plaintext + 4, s3);
    PUTU32(plaintext + 8, s0);
    PUTU32(plaintext + 12, s1);
}
开发者ID:InfoHunter,项目名称:openssl,代码行数:45,代码来源:camellia.c

示例13: Zig

	void Zig(Vertex<T>* d) {
		Vertex<T>* b(d->father);
		if (b->right_son == d) {
			RightRotate(d);
		} else if (b->left_son == d) {
			LeftRotate(d);
		}
		root = FindRoot(root);
	}
开发者ID:luxe,项目名称:Cpp-mini-program-scraps,代码行数:9,代码来源:ideone-c++4.8.1-t550kg-20:02:44_2014-02-27_cET.cpp

示例14: maintain

 void maintain(int &root , bool flag)
 {
     if (root == 0) return ;
     if ( !flag )
     {
         if ( SZ[LC[LC[root]]] > SZ[RC[root]] )
         {
             RightRotate( root );
         }
         else if ( SZ[RC[LC[root]]] > SZ[RC[root]] )
         {
             LeftRotate( LC[root] );
             RightRotate( root );
         }
         else
         {
             return ;
         }
     }
     else
     {
         if ( SZ[RC[RC[root]]] > SZ[LC[root]] )
         {
             LeftRotate( root );
         }
         else if ( SZ[LC[RC[root]]] > SZ[LC[root]] )
         {
             RightRotate( RC[root] );
             LeftRotate( root );
         }
         else
         {
             return ;
         }
     }
     maintain(LC[root] , false);
     maintain(RC[root] , true);
     maintain(root , false);
     maintain(root , true);
 }
开发者ID:fanshaoze,项目名称:acm-codes,代码行数:40,代码来源:NOTONLLY的SBT模板.cpp

示例15: while

void RedBlackTree::RBDeleteFix(RedBlackNode *pNode)
{
    while (pNode != m_pRoot && pNode->m_nColor == black)
    {
        if (pNode = pNode->m_pParent->m_pLeft)
        {
            RedBlackNode *pBrother = pNode->m_pParent->m_pRight;
            if (pBrother->m_nColor == red)
            {
                pBrother->m_nColor = black;
                pBrother->m_pParent->m_nColor = red;
                LeftRotate(pNode->m_pParent);
                pBrother = pNode->m_pParent->m_pRight;
            }
            if (pBrother->m_pLeft->m_nColor == black && pBrother->m_pRight->m_nColor == black)
            {
                pBrother->m_nColor = red;
                pNode = pNode->m_pParent;
            }
            else if (pBrother->m_pRight->m_nColor = black)
            {
                pBrother->m_pLeft->m_nColor = black;
                pBrother->m_nColor = red;
                RightRotate(pBrother);
                pBrother = pNode->m_pParent->m_pRight;
            }

            pBrother->m_nColor = pNode->m_pParent->m_nColor;
            pNode->m_pParent->m_nColor = black;
            pBrother->m_pRight->m_nColor = black;
            LeftRotate(pNode->m_pParent);
            pNode = m_pRoot;
        }
        else
        {

        }
    }
    pNode->m_nColor = black;
}
开发者ID:kinnylee,项目名称:Project,代码行数:40,代码来源:RedBlackTree.cpp


注:本文中的LeftRotate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。