Pattern-avoiding access in binary search trees

Parinya Chalermsook, Mayank Goswami, László Kozma, Kurt Mehlhorn, Thatchaphol Saranurak

Abstract

The Dynamic Optimality Conjecture posits the existence of an online Binary Search Tree (BST) algorithm that is constant-factor competitive with any other BST algorithm. This paper advances the conjecture by applying the combinatorial concept of pattern avoidance to access sequences. We demonstrate that the Greedy BST algorithm is nearly optimal for a broad class of "easy" sequences, providing a near-solution to the long-standing Traversal Conjecture.

Introduction

Binary Search Trees (BSTs) are foundational data structures. While balanced trees like Red-Black trees offer guaranteed logarithmic performance, the search for a "dynamically optimal" BST remains a central challenge in theoretical computer science. Such an algorithm would perform as well as any offline algorithm that knows the entire access sequence in advance. The primary candidates for this role are Splay Trees and the Greedy algorithm.

A significant hurdle in proving dynamic optimality is the Traversal Conjecture, which states that accessing elements in a preorder traversal should take linear time. Until now, no online BST algorithm had been proven to satisfy this. This research bridges that gap by categorizing access sequences through the lens of pattern avoidance.

Geometric Modeling and Pattern Avoidance

To analyze BST performance, the authors utilize a geometric model where an access sequence of length $n$ on $n$ keys is represented as a set of $n$ points in a 2D plane. In this framework, the execution of a BST algorithm corresponds to adding "touch points" to satisfy specific geometric constraints, such as the "empty rectangle" condition.

An access sequence represented as a set of points in a 2D plane.

The core innovation lies in identifying that many "easy" access sequences—those with low execution costs—avoid certain small permutations or patterns. For instance, sequential access or preorder traversals can be characterized as pattern-avoiding sequences. By applying forbidden submatrix theory, specifically the Marcus-Tardos theorem, the authors bound the density of the resulting geometric matrix, proving that Greedy remains efficient when the input avoids these patterns.

Recursive Decomposition and RGreedy

The paper introduces "Robust Greedy" (RGreedy), an offline variant that facilitates analysis through recursive decomposition. This method breaks down complex access sequences into smaller, independent sub-blocks, forming a hierarchical structure known as a permutation tree.

The process of decomposing a geometric point set into a recursive tree structure (permutation tree) to analyze Greedy's performance.

This decomposition reveals that Greedy is "input-revealing": its execution log mirrors the structural constraints of the input sequence. If a sequence is $k$-decomposable (can be recursively split into blocks of size at most $k$), the total work performed by Greedy can be strictly bounded.

Key Results

The authors achieve several landmark results:

  1. Near-Linear Traversal: They prove that Greedy's cost for preorder sequences is $n \cdot 2^{\alpha(n)^{O(1)}}$, where $\alpha(n)$ is the inverse Ackermann function. This "almost linear" bound is a massive step toward the Traversal Conjecture.
  2. Linearity with Preprocessing: If the algorithm is allowed a small initial setup time, Greedy achieves true linear cost ($O(n)$) for preorder traversals.
  3. General Pattern Avoidance: For any sequence avoiding a pattern of size $k$, Greedy's cost is bounded by $n \cdot 2^{\alpha(n)^{O(k)}}$.
  4. Optimality on Decomposable Sequences: For $k$-decomposable sequences, Greedy matches the intrinsic optimal cost of $\Theta(n \log k)$ when $k$ is constant.

Conclusion and Future Directions

By reframing BST optimality in terms of combinatorial pattern avoidance, this work provides a unified framework for understanding why certain access patterns are "easy." While the $2^{\alpha(n)}$ factor is technically non-constant, it is functionally negligible, bringing us closer than ever to proving the Dynamic Optimality Conjecture. Future work will focus on closing this final gap to achieve true $O(n)$ bounds and extending these geometric techniques to analyze Splay Trees.

Summary updated

BibTeX
@inproceedings{chalermsook2015pattern,
  author = {Parinya Chalermsook and Mayank Goswami and László Kozma and Kurt Mehlhorn and Thatchaphol Saranurak},
  title = {{Pattern-avoiding access in binary search trees}},
  booktitle = {FOCS},
  year = {2015},
  url = {https://openreview.net/forum?id=SOdpCVR_Bi},
}
Figure