# Splaying Preorders and Postorders

**Authors:** Caleb C. Levy, Robert E. Tarjan

arXiv: 1907.06309 · 2019-07-16

## TL;DR

This paper proves that splaying preorder and postorder sequences in binary search trees can be done in linear time, leveraging pattern-avoidance and properties of balanced trees, supporting the dynamic optimality conjecture.

## Contribution

It introduces new linear-time bounds for splaying preorder and postorder sequences using pattern-avoidance and balanced tree properties.

## Key findings

- Splaying preorder/postorder sequences in an empty BST takes linear time.
- Splaying these sequences from a weight-balanced BST also takes linear time.
- Preorders and postorders of balanced trees have few large jumps, aiding efficient splaying.

## Abstract

Let $T$ be a binary search tree. We prove two results about the behavior of the Splay algorithm (Sleator and Tarjan 1985). Our first result is that inserting keys into an empty binary search tree via splaying in the order of either $T$'s preorder or $T$'s postorder takes linear time. Our proof uses the fact that preorders and postorders are pattern-avoiding: i.e. they contain no subsequences that are order-isomorphic to $(2,3,1)$ and $(3,1,2)$, respectively. Pattern-avoidance implies certain constraints on the manner in which items are inserted. We exploit this structure with a simple potential function that counts inserted nodes lying on access paths to uninserted nodes. Our methods can likely be extended to permutations that avoid more general patterns. Second, if $T'$ is any other binary search tree with the same keys as $T$ and $T$ is weight-balanced (Nievergelt and Reingold 1973), then splaying $T$'s preorder sequence or $T$'s postorder sequence starting from $T'$ takes linear time. To prove this, we demonstrate that preorders and postorders of balanced search trees do not contain many large "jumps" in symmetric order, and exploit this fact by using the dynamic finger theorem (Cole et al. 2000). Both of our results provide further evidence in favor of the elusive "dynamic optimality conjecture."

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1907.06309/full.md

## Figures

4 figures with captions in the complete paper: https://tomesphere.com/paper/1907.06309/full.md

## References

25 references — full list in the complete paper: https://tomesphere.com/paper/1907.06309/full.md

---
Source: https://tomesphere.com/paper/1907.06309