Repeating this analysis for each pair of rotations as we go up, we
are left with a final debt equal to
(since x is now the root, W(x)=n). We pay for this
(plus possibly an extra credit to pay for the final zig) and we're
home free.
Along the way, we pay for each rotation pair and place credits in the tree to maintain the credit rule.
Therefore, a splay operation in a tree of size n has an
amortized cost of
. So a sequence of k splays will cost
.