******** fig4.59 ********** void zig_zig_left( splay_ptr x ) { splay_ptr p, g, B, C, ggp; p = x->parent; g = p->parent; B = x->right; C = p->right; ggp = g->parent; x->right = p; /* x's new right child is p*/ p->parent = x; p->right = g; /* p's new right child is g */ g->parent = p; if( B != NULL ) /* p's new left child is subtree B */ B->parent = p; p->left = B; if( C != NULL ) /* g's new left child is subtree C */ C->parent = g; g->left = C; x->parent = ggp; /* connect to rest of the tree */ if( ggp != NULL ) if( ggp->left == g ) ggp->left = x; else ggp->right = x; }