English

Permutation patterns in streams

Data Structures and Algorithms 2025-07-21 v2

Abstract

Permutation patterns and pattern avoidance are central, well-studied concepts in combinatorics and computer science. Given two permutations τ\tau and π\pi, the pattern matching problem (PPM) asks whether τ\tau contains π\pi. This problem arises in various contexts in computer science and statistics and has been studied extensively in exact-, parameterized-, approximate-, property-testing- and other formulations. In this paper, we study pattern matching in a streaming setting, when the input τ\tau is revealed sequentially, one element at a time. There is extensive work on the space complexity of various statistics in streams of integers. The novelty of our setting is that the input stream is a permutation, which allows inferring some information about future inputs. Our algorithms crucially take advantage of this fact, while existing lower bound techniques become difficult to apply. We show that the complexity of the problem changes dramatically depending on the pattern π\pi. The space requirement is: Θ(klogn)\Theta(k\log{n}) for the monotone patterns π=12k\pi = 12\dots k, or π=k21\pi = k\dots21, O(nlogn)O(\sqrt{n\log{n}}) for π{312,132}\pi \in \{312,132\}, O(nlogn)O(\sqrt{n} \log n) for π{231,213}\pi \in \{231,213\}, and Θ~π(n)\widetilde{\Theta}_{\pi}(n) for all other π\pi. If τ\tau is an arbitrary sequence of integers (not necessary a permutation), we show that the complexity is Θ~π(n)\widetilde{\Theta}_{\pi}(n) in all except the first (monotone) cases.

Keywords

Cite

@article{arxiv.2507.11291,
  title  = {Permutation patterns in streams},
  author = {Benjamin Aram Berendsohn},
  journal= {arXiv preprint arXiv:2507.11291},
  year   = {2025}
}