**fig4_60.txt** /* 1*/ template /* 2*/ void /* 3*/ Splay_Node:: /* 4*/ Zig_Zig_Left( Splay_Node * const X ) /* 5*/ { /* 6*/ Splay_Node *P = X->Parent; /* 7*/ Splay_Node *G = P->Parent; /* 8*/ Splay_Node *B = ( Splay_Node * )( X->Right ); /* 9*/ Splay_Node *C = ( Splay_Node * )( P->Right ); /*10*/ Splay_Node *Ggp = G->Parent; /*11*/ X->Right = P; // X's new right child is P. /*12*/ P->Parent = X; /*13*/ P->Right = G; // P's new right child is G. /*14*/ G->Parent = P; /*15*/ if( B != NULL ) // P's new left subtree is B. /*16*/ B->Parent = P; /*17*/ P->Left = B; /*18*/ if( C != NULL ) // G's new left child is subtree C. /*19*/ C->Parent = G; /*20*/ G->Left = C; /*21*/ X->Parent = Ggp; // Connect to rest of the tree. /*22*/ if( Ggp != NULL ) /*23*/ if( Ggp->Left == G ) /*24*/ Ggp->Left = X; /*25*/ else /*26*/ Ggp->Right = X; /*27*/ } /* 1*/ template /* 2*/ void /* 3*/ Splay_Node:: /* 4*/ Zig_Left_Zag_Right( Splay_Node * const X ) /* 5*/ { /* 6*/ Zig_Right( X ); /* 7*/ Zig_Left( X ); /* 8*/ }