Let st-1 and st be the size functions just before and after the step. Let y be the parent of x and z be the parent of y (if it exists).
We'll define the amortized cost to be for Zig and
for
the other cases. The amortized cost for a sequence of h steps
splaying x up the tree, therefore, is
This is . Why?
This means that our amortized cost for each complete splay is
, even if we start deep in the tree. The intuition is
that, the only way we could make the tree that deep in the first place
is to have performed operations that increase the potential
substantially. So, the average still works out.