figure zig-zag figure zig-zig path let be (non-rootnode on the access path at which we are rotating if the parent of is the root of the treewe merely rotate and the root this is the last rotation along the access path otherwisex has both parent (pand grandparent ( )and there are two casesplus symmetriesto consider the first case is the zig-zag case (see fig here is right child and is left child (or vice versaif this is the casewe perform double rotationexactly like an avl double rotation otherwisewe have zig-zig casex and are both left children (orin the symmetric caseboth right childrenin that casewe transform the tree on the left of figure to the tree on the right as an exampleconsider the tree from the last examplewith contains on the first splay step is at and is clearly zig-zagso we perform standard avl double rotation using and the resulting tree follows