arXiv ScienceSearch

arXiv · 1509.08216

Fast Algorithms for Finding Pattern Avoiders and Counting Pattern Occurrences in Permutations

Abstract

Given a set $Π$ of permutation patterns of length at most $k$, we present an algorithm for building $S_{\le n}(Π)$, the set of permutations of length at most $n$ avoiding the patterns in $Π$, in time $O(|S_{\le n - 1}(Π)| \cdot k + |S_{n}(Π)|)$. Additionally, we present an $O(n!k)$-time algorithm for counting the number of copies of patterns from $Π$ in each permutation in $S_n$. Surprisingly, when $|Π| = 1$, this runtime can be improved to $O(n!)$, spending only constant time per permutation. Whereas the previous best algorithms, based on generate-and-check, take exponential time per permutation analyzed, all of our algorithms take time at most polynomial per outputted permutation. If we want to solve only the enumerative variant of each problem, computing $|S_{\le n}(Π)|$ or tallying permutations according to $Π$-patterns, rather than to store information about every permutation, then all of our algorithms can be implemented in $O(n^{k+1}k)$ space. Using our algorithms, we generated $|S_5(Π)|, \ldots, |S_{16}(Π)|$ for each $Π\subseteq S_4$ with $|Π| > 4$, and analyzed OEIS matches. We obtained a number of potentially novel pattern-avoidance conjectures. Our algorithms extend to considering permutations in any set closed under standardization of subsequences. Our algorithms also partially adapt to considering vincular patterns.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

William Kuszmaul. 2017-03-17. Fast Algorithms for Finding Pattern Avoiders and Counting Pattern Occurrences in Permutations. https://arxiv.org/abs/1509.08216

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

Oblivious Self-Distance Symmetric Rendezvous on the Integer Line

Symmetric rendezvous on the line is a search problem in which two agents, initially placed at distance $2d$, must follow the same randomized strategy to meet as quickly as possible. In the standard model, agents may condition their actions on the entire execution history, and both the known- and unknown-distance variants admit expected rendezvous time $Θ(d)$. We study the role of memory by introducing oblivious self-distance strategies, in which an agent's decision depends only on her position relative to her own starting location. For an initial separation of $2d$, let $R_d$ denote the optimal oblivious expected rendezvous time in the known-distance setting. We develop two finite-state frameworks based on absorbing Markov chains. Truncated chains give computable upper bounds through finite-support strategies, while weak-peek chains give lower bounds through a revealed-information relaxation. Together, they provide a mechanism for certifying optimality. Using that mechanism, we determine $R_1$ exactly and prove that it is attained by a finite-support strategy. For $d=2,\ldots,6$, numerical optimization gives the same truncation structure and objective values, yielding rigorous upper bounds below $7.83d^2$. We do not prove that the computed weak-peek minimizers are global, but the stability of the computations leads us to conjecture that they are, in which case the corresponding truncated strategies are optimal. We also prove that $R_d=Θ(d^2)$. In the unknown-distance setting, we construct a universal strategy, independent of $d$, with expected rendezvous time $O(d^{2+η})$ for every fixed $η>0$. Thus, under the memory restriction, the known-distance rendezvous time becomes quadratic, while near-quadratic performance remains possible even without knowing $d$. The asymptotic analysis uses birth-death Markov chains and their electrical-network interpretation.

cs.DM

Tournaments not inducible by five voters

A tournament T is k-inducible if there are k linear orders on its vertex set such that, for every arc $i \to j$ of T, a majority of the orders rank i above j. For odd k, let N(k) be the least order at which some tournament is not k-inducible. Only N(3) = 8 is known exactly; for N(5) the best bounds were $12 \le N(5) \le 38$, from our previous paper [2], which also gave the first explicit example of moderate order, the Paley tournament $P_{43}$. Results. A bespoke search algorithm improves both ends: $13 \le N(5) \le 23$. The upper bound comes from proving that $P_{23}$ is not 5-inducible, the case Bachmeier et al. [1] reported they could not decide, their SAT solver not having terminated within a cumulative six weeks; ours takes 22 hours on one laptop. The lower bound comes from an analysis at order 12. We also show that $P_{31}$ is not 5-inducible, while $P_{19}$ is 5-inducible but not with unit margin, that is, not by a profile in which every arc is carried by exactly three voters against two. Both $P_{19}$ and $P_{23}$ are arc-critical for their respective properties, whereas $P_{31}$ and $P_{43}$ are not vertex-critical: deleting a vertex leaves a tournament that is still not 5-inducible. Method. The search places one vertex at a time, always choosing the vertex with the fewest options left, and propagates the consequences. Together with the automorphisms of the tournament, this decides on a single laptop instances that neither integer programming nor a general-purpose SAT solver can settle. The refutations for $P_{19}$ and $P_{23}$ are certified as well: the search is split into independent subproblems, a SAT solver emits a machine-checkable proof for each, and a separate program rechecks every proof. All results, subject to two human-checked lemmas, are reproducible from https://github.com/Leonardini/TournamentsBeyond5Voters.

cs.DM

Two-Machine Flow Shop with a Fixed Non-Availability Interval on the Second Machine

This paper investigates a two-machine permutation flow shop in which the second machine is unavailable during one fixed interval $[s,t]$. We consider the non-resumable setting: an operation interrupted by the interval must restart from the beginning after the machine becomes available. The objective is to minimize the makespan. We establish three results. First, we give a polynomial-time $10/7$-approximation algorithm. Second, we develop a pseudopolynomial-time exact dynamic program. Third, we prove that the problem does not admit a fully polynomial-time approximation scheme (FPTAS) unless $\mathrm{P}=\mathrm{NP}$, even when the non-availability interval has unit length. Together, these results characterize a distinctive complexity profile: exact optimization is possible in pseudopolynomial time, whereas the usual route from such an algorithm to an FPTAS is impossible unless $\mathrm{P}=\mathrm{NP}$. They also reveal an approximability separation from the corresponding non-resumable problem with the interval on the first machine.

cs.DM