When inserting an item into a splay tree, rotations are performed in pairs based on either a zig-zag or zig-zig pattern. When there is an odd number of rotations to be performed, one could either do the extra rotation beginning at the leaf or save the extra rotation and do it at the root. Does it matter?
For example, in the attached image I insert a 4 into a BST, and "splay it" it to the root. On the top of the figure, I first locate the zig-zig pair at the leaf node and perform the zig-zag splay from the bottom leaving a final right rotation at the root. At the bottom of the figure, I first do the odd rotation starting from the leaf, and the then do a zig-zig splay to the root.
Which is correct? Or will both lead to the usual splay-tree performance?
