Entire Splay

Repeating this analysis for each pair of rotations as we go up, we are left with a final debt equal to tex2html_wrap_inline227 (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 tex2html_wrap_inline161 . So a sequence of k splays will cost tex2html_wrap_inline145 .


next up previous
Next: HOMEWORK Up: ANALYSIS OF SPLAY TREES Previous: Paying for Rotation: Zig-Zig