Binary Search Trees in Lean Check a result Declarations Bibliography Lean source

Chapter 24Splay trees

Splay trees, introduced by Sleator and Tarjan in 1985, are the best-known self-adjusting binary search tree. They store no balance information. After every access they move the accessed node to the root by a fixed pattern of rotations, and this alone gives O(log⁡n)O(\log n) amortized cost per access, and much better bounds on structured sequences. Whether splay trees are dynamically optimal is open.

The chapter has three sections.

  • Section 24.1 defines splaying, proves that it is a legal BST algorithm in the rotation model, and runs it on the pointer machine.
  • Section 24.2 proves Theorems 1–5 of the 1985 paper from the access lemma: O(log⁡n)O(\log n) amortized cost, static optimality, the static finger bound, the working-set bound, and a bound that charges each access the smallest of the three.
  • Section 24.3 treats insertion, deletion, split and join, splaying only along long paths, the snapshot theorem, and Tarjan’s theorem that sequential access takes linear time.

Splay trees return in Chapter 30, which builds a deamortized splay tree: it keeps the access bounds of Section 24.2 and the sequential access bound, and every access costs O(log⁡n)O(\log n) in the worst case. Two further results about splay trees are not formalized. The dynamic finger theorem of Cole and coauthors (Cole et al. 2000; Cole 2000) is discussed in Chapter 14. The theorem of Chmel et al. (2026), that splay trees are O(log⁡log⁡n⋅log⁡2log⁡log⁡n)O(\log\log n \cdot \log^2\log\log n)-competitive, is shown as a dashed arrow in the map of the bounds and is listed in the library’s roadmap.