Table of Contents
Fetching ...

An Optimal Algorithm for Sorting Pattern-Avoiding Sequences

Michal Opler

TL;DR

The paper resolves the complexity of sorting π-avoiding inputs in linear time with a multiplicative constant that matches the information-theoretic lower bound up to the pattern-dependent Füredi-Hajnal constant $c_π$. It introduces a two-pronged approach: (i) a Marcus-Tardos-based efficient multi-way merge capable of handling many π-avoiding sequences, and (ii) a method for sorting a large number of short π-avoiding sequences using near-optimal decision-tree strategies. The combination yields an asymptotically optimal algorithm that works even when π is unknown and extends to permutations of bounded twin-width with linear-time performance. The results connect pattern avoidance, extremal matrix theory, and dynamic optimality concepts, offering practical implications for fast sorting in structured inputs and related combinatorial settings.

Abstract

We present a deterministic comparison-based algorithm that sorts sequences avoiding a fixed permutation $π$ in linear time, even if $π$ is a priori unkown. Moreover, the dependence of the multiplicative constant on the pattern $π$ matches the information-theoretic lower bound. A crucial ingredient is an algorithm for performing efficient multi-way merge based on the Marcus-Tardos theorem. As a direct corollary, we obtain a linear-time algorithm for sorting permutations of bounded twin-width.

An Optimal Algorithm for Sorting Pattern-Avoiding Sequences

TL;DR

The paper resolves the complexity of sorting π-avoiding inputs in linear time with a multiplicative constant that matches the information-theoretic lower bound up to the pattern-dependent Füredi-Hajnal constant . It introduces a two-pronged approach: (i) a Marcus-Tardos-based efficient multi-way merge capable of handling many π-avoiding sequences, and (ii) a method for sorting a large number of short π-avoiding sequences using near-optimal decision-tree strategies. The combination yields an asymptotically optimal algorithm that works even when π is unknown and extends to permutations of bounded twin-width with linear-time performance. The results connect pattern avoidance, extremal matrix theory, and dynamic optimality concepts, offering practical implications for fast sorting in structured inputs and related combinatorial settings.

Abstract

We present a deterministic comparison-based algorithm that sorts sequences avoiding a fixed permutation in linear time, even if is a priori unkown. Moreover, the dependence of the multiplicative constant on the pattern matches the information-theoretic lower bound. A crucial ingredient is an algorithm for performing efficient multi-way merge based on the Marcus-Tardos theorem. As a direct corollary, we obtain a linear-time algorithm for sorting permutations of bounded twin-width.
Paper Structure (25 sections, 10 theorems, 10 equations, 2 figures, 3 algorithms)

This paper contains 25 sections, 10 theorems, 10 equations, 2 figures, 3 algorithms.

Key Result

Theorem 1.1

There is an algorithm that sorts a $\pi$-avoiding sequence $S$ of length $n$ in $O((\log c_\pi + 1) \cdot n)$ time even if $\pi$ is a priori unknown.

Figures (2)

  • Figure 1: The permutation $3,1,5,2,4$ as a matrix (a) and using bullets for 1-entries and blanks for 0-entries following convention (b); an occurrence of the pattern $2,1,3$ (c) is highlighted.
  • Figure 2: A decision tree $T$ for sorting a sequence of length $3$. A run on input sequence $(s_1, s_2, s_3) = (7,2,3)$ is highlighted and it reaches a leaf labeled by the permutation $2, 3, 1$. Indeed, we have $s_2 \le s_3 \le s_1$ and $T$ correctly sorts $S$. Notice that the tree contains many unnecessary branches since we require the decision trees to be full binary trees.

Theorems & Definitions (18)

  • Theorem 1.1
  • Corollary 1.2
  • Lemma 2.1
  • Theorem 3.1
  • Claim 3.2
  • proof
  • Claim 3.3
  • proof
  • Lemma 3.4
  • proof
  • ...and 8 more