PromoteNode
VOID __stdcall PromoteNode(_RTL_BALANCED_LINKS *C){
_RTL_BALANCED_LINKS *Parent;
_RTL_BALANCED_LINKS *v2;
_RTL_BALANCED_LINKS *LeftChild;
_RTL_BALANCED_LINKS *RightChild;
Parent = C->Parent;
v2 = C->Parent->Parent;
if( C->Parent->LeftChild == C )
{
RightChild = C->RightChild;
Parent->LeftChild = RightChild;
if( RightChild )
RightChild->Parent = Parent;
C->RightChild = Parent;
}
else
{
LeftChild = C->LeftChild;
Parent->RightChild = LeftChild;
if( LeftChild )
LeftChild->Parent = Parent;
C->LeftChild = Parent;
}
Parent->Parent = C;
if( v2->LeftChild == Parent )
v2->LeftChild = C;
else
v2->RightChild = C;
C->Parent = v2;
}Referenced by:
RebalanceNode