Splaying Preorders and Postorders
Pith reviewed 2026-05-24 21:35 UTC · model grok-4.3
The pith
Splaying the preorder or postorder sequence of a binary search tree inserts its keys in linear time.
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
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. The proof exploits that preorders avoid subsequences order-isomorphic to (2,3,1) and postorders avoid (3,1,2), which imposes insertion constraints that a potential counting inserted nodes on paths to uninserted nodes can exploit. When T is weight-balanced, the same linear bound holds even if splaying begins from an arbitrary tree T' on the same keys, because such traversals contain few large jumps and the dynamic finger theorem applies.
What carries the argument
Pattern avoidance in preorders and postorders, which constrains the relative positions of inserted and uninserted keys and enables a potential function that counts inserted nodes lying on access paths to uninserted nodes; the dynamic finger theorem is used in the weight-balanced case.
If this is right
- Splay trees achieve linear cost on the natural traversal orders of any binary search tree.
- The same linear bound holds when the starting tree is arbitrary but the source tree is weight-balanced.
- The potential-function technique based on pattern avoidance may apply to other classes of pattern-avoiding insertion sequences.
- These linear-time results supply additional evidence toward the dynamic optimality conjecture.
Where Pith is reading between the lines
- If the pattern-avoidance approach generalizes, splay trees may run in linear time on additional families of access sequences that arise from tree traversals.
- The limited-jump property of balanced preorders and postorders could be used to analyze splay performance under other access models that involve symmetric-order locality.
Load-bearing premise
Preorders and postorders avoid the patterns (2,3,1) and (3,1,2) respectively, which imposes strong limits on how inserted nodes can interleave with uninserted ones during splaying.
What would settle it
An explicit preorder or postorder sequence of a weight-balanced tree whose total splaying cost, either from an empty tree or from another tree, exceeds linear in the number of keys.
Figures
read the original 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."
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper proves two results on splay trees. First, inserting the keys of a BST T into an initially empty tree by splaying in the preorder (resp. postorder) sequence of T takes O(n) time; the argument uses the classical 231-avoidance (resp. 312-avoidance) of these sequences together with a potential function that counts already-inserted nodes lying on paths to uninserted nodes. Second, when T is weight-balanced, the same sequences can be splayed starting from an arbitrary initial tree T' on the same keys and the total cost remains linear; this follows from showing that the sequences contain only O(n) large symmetric-order jumps and invoking the dynamic finger theorem of Cole et al. (2000). Both results are offered as further evidence for the dynamic-optimality conjecture.
Significance. If the claims hold, the work supplies two infinite families of access sequences for which splay trees are dynamically optimal, thereby strengthening the empirical and theoretical case for the conjecture. The proofs are self-contained once the cited external results (pattern-avoidance facts and the dynamic finger theorem) are granted, and the potential-function argument is a natural fit for the recursive structure of preorder and postorder traversals. The observation that the same techniques may extend to other pattern-avoiding permutations is noted but left unexplored.
minor comments (3)
- §2, paragraph after Definition 2.1: the sentence 'Pattern-avoidance implies certain constraints…' is vague; a one-sentence reminder of the precise insertion-order constraints used later would improve readability.
- §4, proof of Theorem 4.2: the bound on the number of large jumps is stated as O(n) but the constant hidden by the weight-balance assumption is not made explicit; adding a short calculation relating subtree-size ratios to jump length would clarify the application of the dynamic finger theorem.
- The paper cites Sleator-Tarjan 1985 and Cole et al. 2000 but does not include a brief comparison paragraph with the earlier 'sequential access' and 'deque' results; such a paragraph would help situate the new linear-time families.
Simulated Author's Rebuttal
We thank the referee for the positive report, accurate summary of our results, and recommendation to accept. We appreciate the recognition that the work supplies infinite families of access sequences for which splay trees are dynamically optimal.
Circularity Check
No significant circularity; derivation relies on external classical results
full rationale
The paper establishes linear-time splaying for preorder/postorder sequences using pattern-avoidance (classical for BST traversals), a potential counting inserted nodes on paths, and the dynamic finger theorem (Cole et al. 2000). These inputs are independent of the present claims, not fitted parameters, and not justified via self-citation chains. The weight-balanced case reduces to showing O(n) jumps via balanced subtree sizes, which follows directly from the tree definition without redefining the target bound. No step equates a prediction to its input by construction.
Axiom & Free-Parameter Ledger
axioms (3)
- standard math Binary search trees maintain symmetric order during insertions and splaying
- domain assumption Preorder and postorder permutations avoid specific patterns (2,3,1) and (3,1,2)
- standard math The dynamic finger theorem applies to bound splay costs
Reference graph
Works this paper leans on
-
[1]
G. Adel’son-Vel’skii and E. Landis. An algorithm for the organization of information. Sov. Math. Dokl., 3:1259–1262, 1962
work page 1962
-
[2]
M. Akra and L. Bazzi. On the solution of linear recurrence equations. Computational Optimization and Applications, 10(2):195–210, 1998
work page 1998
-
[3]
P. Chalermsook, M. Goswami, L. Kozma, K. Mehlhorn, and T. Saranurak. Pattern-avoiding access in binary search trees. InFOCS, pages 410–423, 2015
work page 2015
-
[4]
R. Chaudhuri andH. HÃűft. Splayinga search treein preorder takeslinear time. ACM SIGACT News, 24(2):88–93, 1993
work page 1993
-
[5]
R. Cole. On the dynamic finger conjecture for splay trees. part ii: the proof. SICOMP, 30(1):44–85, 2000
work page 2000
-
[6]
R. Cole, B. Mishra, J. Schmidt, and A. Siegel. On the Dynamic Finger Conjecture for Splay Trees. Part I: Splay Sortinglogn-Block Sequences. SICOMP, 30(1):1–43, 2000. 13
work page 2000
-
[7]
E. Demaine, D. Harmon, J. Iacono, D. Kane, and M. PÇŐtraŧcu. The geometry of binary search trees. InSODA, pages 496–505, 2009
work page 2009
-
[8]
K.Fox.Upperboundsformaximallygreedybinarysearchtrees.In WADS, pages 411–422, 2011
work page 2011
-
[9]
N. Goyal and M. Gupta. Better analysis of binary search tree on decom- posable sequences.Theoretical Computer Science, 2019
work page 2019
-
[10]
L. Guibas and R. Sedgewick. A dichromatic framework for balanced trees. In FOCS, pages 8–21, 1978
work page 1978
-
[11]
B. Haeupler, S. Sen, and R. Tarjan. Rank-balanced trees.TALG, 11(4), 2015
work page 2015
-
[12]
J. Iacono and S. Langerman. Weighted dynamic finger in binary search trees. InSODA, pages 672–691, 2016
work page 2016
-
[13]
L. Kozma. Binary Search Trees, Rectangles and Patterns. PhD thesis, Saarland University, 2016
work page 2016
-
[14]
J. Kujala and T. Elomaa. The cost of offline binary search tree algorithms and the complexity of the request sequence.TCS, 393:231–239, 2008
work page 2008
-
[15]
C. Levy and R. Tarjan. A new path from splay to dynamic optimality. In SODA, pages 1311–1330, 2019
work page 2019
-
[16]
J. Lucas. Canonical Forms for Competitive Binary Search Tree Algo- rithms. Technical report, Rutgers University, 1988
work page 1988
-
[17]
I. Munro. On the competitiveness of linear search. InESA, pages 338–345, 2000
work page 2000
-
[18]
J. Nievergelt and E. Reingold. Binary search trees of bounded balance. SICOMP, 2(1):33–43, 1973
work page 1973
-
[19]
S. Pettie. Applications of forbidden 0-1 matrices to search tree and path compression-based data structures. InSODA, pages 1457–1467, 2010
work page 2010
-
[20]
S. Pettie. Splay trees, davenport-schinzel sequences, and the deque con- jecture. InSODA, pages 1115–1124, 2008
work page 2008
-
[21]
D. Sleator and R. Tarjan. Self-adjusting binary search trees. J. ACM, 32(3):652–686, 1985
work page 1985
-
[22]
R. Sundar. On the deque conjecture for the splay algorithm.Combinator- ica, 12(1):95–124, 1992
work page 1992
-
[23]
R. Tarjan. Amortized computational complexity.SIAM Journal on Alge- braic and Discrete Methods, 6(2):306–318, 1985
work page 1985
-
[24]
R. Tarjan. Sequential access in splay trees takes linear time.Combinator- ica, 5(4):367–378, 1985
work page 1985
-
[25]
R. Wilber. Lower bounds for accessing binary search trees with rotations. SICOMP, 18(1):56–67, 1989. 14
work page 1989
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.