Do a sequence of inserts, then traverse the resulting tree. How?
Running time: Clearly O(n2). Why?
We will see, in fact, that any sequence of k splays on a tree
with n nodes runs in . Amazing!
We will use potential functions and amortized analysis to show this.
Therefore, what is splay sort's running time?