We prove that the set of permutations generated by a stack of depth two and an infinite stack in series has a basis (defining set of forbidden patterns) consisting of 20 permutations of length 5, 6, 7 and 8. We prove this via a ``canonical'' generating algorithm.
We use stack words to find a new, simple proof for the best known upper bound for the number of 3-stack sortable permutations of a given length. This is the first time that stack words are used to obtain such a result.
We describe a new method for finding patterns in permutations that produce a given pattern after the permutation has been passed once through a stack. We use this method to describe West-3-stack-sortable permutations, that is, permutations that are sorted by three passes through a stack. We also show how the method can be applied to the bubble-sort operator. The method requires the use of mesh patterns introduced by Brändén and Claesson (2011), as well as a new type of generalized pattern we call a decorated pattern.
In this thesis, we apply the stack sorting operator to $r$-permutations and construct the functional equation for the generating function of two-stack-sortable $k$-tuple $r$-permutations counted by descents by using a factorization similar to Zeilberger's. We solve the functional equation and give explicit formulas for the number of two-stack-sortable $r$-permutations.
We characterise and enumerate permutations that are sortable by n-4 passes through a stack. We conjecture the number of permutations sortable by n-5 passes, and also the form of a formula for the general case n-k, which involves a polynomial expression.
Pop-stacks are variants of stacks that were introduced by Avis and Newborn in 1981. Coincidentally, a 1982 result of Unger implies that every permutation of length n can be sorted by n-1 passes through a deterministic pop-stack. We give a new proof of this result inspired by Knuth's zero-one principle.
Using earlier results we prove a formula for the number $W_{(n,k)}$ of 2-stack sortable permutations of length $n$ with $k$ runs, or in other words, $k-1$ descents. This formula will yield the suprising fact that there are as many 2-stack sortable permutations with $k-1$ descents as with $k-1$ ascents. We also prove that $W_{(n,k)}$ is unimodal in $k$, for any fixed $n$.
We prove that the set of permutations sorted by a stack of depth $t \geq 3$ and an infinite stack in series has infinite basis, by constructing an infinite antichain. This answers an open question on identifying the point at which, in a sorting process with two stacks in series, the basis changes from finite to infinite.
We consider the set of permutations that are sorted after two passes through a pop stack. We characterize these permutations in terms of forbidden patterns (classical and barred) and enumerate them according to the ascent statistic. Then we show these permutations to be in bijection with a special family of polyominoes. As a consequence, the permutations sortable by this machine are shown to have the same enumeration as three classical permutation classes.
A permutation is so-called two stack sortable if it (i) avoids the (scattered) pattern 2-3-4-1, and (ii) contains a 3-2-4-1 pattern only as part of a 3-5-2-4-1 pattern. Here we show that the permutations on [n] satisfying condition (ii) alone are equinumerous with the permutations on [n] that avoid the mixed scattered/consecutive pattern 31-4-2. The proof uses a known bijection from 3-2-1-avoiding to 3-1-2-avoiding permutations.
In 2017, Duchi, Guerrini, Rinaldi and Schaeffer proposed a new family of combinatorial objects called "fighting fish", which are counted by the same formula as more classical objects, such as two-stack sortable permutations and non-separable planar maps. In this article, we explore the bijective aspect of fighting fish by establishing a bijection to two-stack sortable permutations, using a new recursive decomposition of these permutations. With our bijection, we give combinatorial explanations of several results on fighting fish proved previously with generating functions. Using the decomposit…
Bóna conjectured that the descent polynomials on $(n-2)$-stack sortable permutations have only real zeros. Brändén proved this conjecture by establishing a more general result. In this paper, we give another proof of Brändén's result by using the theory of $s$-Eulerian polynomials recently developed by Savage and Visontai.
In 1990 West conjectured that there are $2(3n)!/((n+1)!(2n+1)!)$ two-stack sortable permutations on $n$ letters. This conjecture was proved analytically by Zeilberger in 1992. Later, Dulucq, Gire, and Guibert gave a combinatorial proof of this conjecture. In the present paper we study generating functions for the number of two-stack sortable permutations on $n$ letters avoiding (or containing exactly once) 132 and avoiding (or containing exactly once) an arbitrary permutation $τ$ on $k$ letters. In several interesting cases this generating function can be expressed in terms of the generating f…
We consider permutations sortable by $k$ passes through a deterministic pop stack. We show that for any $k\in\mathbb N$ the set is characterised by finitely many patterns, answering a question of Claesson and Guðmundsson. Our characterisation demands a more precise definition than in previous literature of what it means for a permutation to avoid a set of barred and unbarred patterns. We propose a new notion called \emph{$2$-avoidance}.
In an exercise in the first volume of his famous series of books, Knuth considered sorting permutations by passing them through a stack. Many variations of this exercise have since been considered, including allowing multiple passes through the stack and using different data structures. We are concerned with a variation using pop-stacks that was introduced by Avis and Newborn in 1981. Let $P_k(x)$ be the generating function for the permutations sortable by $k$ passes through a pop-stack. The generating function $P_2(x)$ was recently given by Pudwell and Smith (the case $k=1$ being trivial). We…
We consider a stack sorting algorithm where only the appropriate output values are popped from the stack and then any remaining entries in the stack are run through the stack in reverse order. We identify the basis for the $2$-reverse pass sortable permutations and give computational results for some classes with larger maximal rev-tier. We also show all classes of $(t+1)$-reverse pass sortable permutations are finitely based. Additionally, a new Entringer family consisting of maximal rev-tier permutations of length $n$ was discovered along with a bijection between this family and the collecti…
We consider the number of passes a permutation needs to take through a stack if we only pop the appropriate output values and start over with the remaining entries in their original order. We define a permutation $π$ to be $k$-pass sortable if $π$ is sortable using $k$ passes through the stack. Permutations that are $1$-pass sortable are simply the stack sortable permutations as defined by Knuth. We define the permutation class of $2$-pass sortable permutations in terms of their basis. We also show all $k$-pass sortable classes have finite bases by giving bounds on the length of a basis elemen…
We prove that the class of permutations generated by passing an ordered sequence $12\dots n$ through a stack of depth 2 and an infinite stack in series is in bijection with an unambiguous context-free language, where a permutation of length $n$ is encoded by a string of length $3n$. It follows that the sequence counting the number of permutations of each length has an algebraic generating function. We use the explicit context-free language to compute the generating function: \begin{align*} \sum_{n\geq 0} c_n t^n &= \frac{(1+q)\left(1+5q-q^2-q^3-(1-q)\sqrt{(1-q^2)(1-4q-q^2)}\right)}{8q} \end{al…
We extend and generalize many of the enumerative results concerning West's stack-sorting map $s$. First, we prove a useful theorem that allows one to efficiently compute $|s^{-1}(π)|$ for any permutation $π$, answering a question of Bousquet-Mélou. We then enumerate permutations in various sets of the form $s^{-1}(\text{Av}(τ^{(1)},\ldots,τ^{(r)}))$, where $\text{Av}(τ^{(1)},\ldots,τ^{(r)})$ is the set of permutations avoiding the patterns $τ^{(1)},\ldots,τ^{(r)}$. These preimage sets often turn out to be permutation classes themselves, so the current paper represents a new approach, based on …
Pattern avoiding machines were recently introduced by Claesson, Ferrari and the current author to gain a better understanding of the classical $2$-stacksort problem. In this paper we generalize these devices by allowing permutations with repeated elements, also known as Cayley permutations. The main result is a description of those patterns such that the corresponding set of sortable permutations is a class. We also show a new involution on the set of Cayley permutations, obtained by regarding a pattern-avoiding stack as an operator. Finally, we analyze two generalizations of pop-stack sorting…
We show that the left-greedy algorithm is a better algorithm than the right-greedy algorithm for sorting permutations using t stacks in series when t>1. We also supply a method for constructing some permutations that can be sorted by t stacks in series and from this get a lower bound on the number of permutations of length n that are sortable by t stacks in series. Finally we show that the left-greedy algorithm is neither optimal nor defines a closed class of permutations for t>2.
Recently Albert and Bousquet-Mélou obtained the solution to the long-standing problem of the enumeration of permutations sortable by two stacks in parallel (2sip). Their solution was expressed in terms of functional equations. E.P. and Guttmann then showed that the equally long-standing problem of the number of permutations sortable by a double ended queue (deque) can be simply related to the solution of the same functional equations. They then conjectured that the radius of convergence of both generating functions is the same, and reduced this conjecture to a series of conjectures of Albert a…
We study permutations that are sorted by operators of the form $\mathbf{S} \circ α\circ \mathbf{S}$, where $\mathbf{S}$ is the usual stack sorting operator introduced by D. Knuth and $α$ is any $D_8$-symmetry obtained combining the classical reverse, complement and inverse operations. Such permutations can be characterized by excluded (generalized) patterns. Some conjectures about the enumeration of these permutations, refined with numerous classical statistics, have been proposed by A. Claesson, M. Dukes and E. Steingrímsson. We prove these conjectures, and enrich one of them with a few more …
We use a method for determining the number of preimages of any permutation under the stack-sorting map in order to obtain recursive upper bounds for the numbers $W_t(n)$ and $W_t(n,k)$ of $t$-stack sortable permutations of length $n$ and $t$-stack sortable permutations of length $n$ with exactly $k$ descents. From these bounds, we are able to significantly improve the best known upper bounds for $\displaystyle{\lim_{n\to\infty}\sqrt[n]{W_t(n)}}$ when $t=3$ and $t=4$.
In this work of thesis we introduce and study a new family of sorting devices, which we call pattern-avoiding machines. They consist of two stacks in series, equipped with a greedy procedure. On both stacks we impose a static constraint in terms of pattern containment: reading the content from top to bottom, the first stack is not allowed to contain occurrences of a given pattern $σ$, whereas the second one is not allowed to contain occurrences of $21$. By analyzing the behavior of pattern-avoiding machines, we aim to gain a better understanding of the problem of sorting permutations with two …
For the elements of a Coxeter group, we present a statistic called depth, defined in terms of factorizations of the elements into products of reflections. Depth is bounded above by length and below by the average of length and reflection length. In this article, we focus on the case of the symmetric group, where we show that depth is equal to sum_i max{w(i)-i, 0}. We characterize those permutations for which depth equals length: these are the 321-avoiding permutations (and hence are enumerated by the Catalan numbers). We also characterize those permutations for which depth equals reflection le…
We prove a "decomposition lemma" that allows us to count preimages of certain sets of permutations under West's stack-sorting map $s$. As a first application, we give a new proof of Zeilberger's formula for the number of 2-stack-sortable permutations in $S_n$. Our proof generalizes, allowing us to find an algebraic equation satisfied by the generating function that counts 2-stack-sortable permutations according to length, number of descents, and number of peaks. The same method yields a recurrence relation for $W_3(n)$, the number of 3-stack-sortable permutations in $S_n$. We compute $W_3(n)$ …
The subject of pattern avoiding permutations has its roots in computer science, namely in the problem of sorting a permutation through a stack. A formula for the number of permutations of length n that can be sorted by passing it twice through a stack (where the letters on the stack have to be in increasing order) was conjectured by West, and later proved by Zeilberger. Goulden and West found a bijection from such permutations to nonseparable planar maps, and later, Jacquard and Schaeffer presented a bijection from these planar maps to certain labeled plane trees, called beta(1,0)-trees. Using…
Pattern avoiding machines were introduced recently by Claesson, Cerbai and Ferrari as a particular case of the two-stacks in series sorting device. They consist of two restricted stacks in series, ruled by a right-greedy procedure and the stacks avoid some specified patterns. Some of the obtained results have been further generalized to Cayley permutations by Cerbai, specialized to particular patterns by Defant and Zheng, or considered in the context of functions over the symmetric group by Berlow. In this work we study pattern avoiding machines where the first stack avoids a pair of patterns …
We address the problem of the number of permutations that can be sorted by two stacks in series. We do this by first counting all such permutations of length less than 20 exactly, then using a numerical technique to obtain nineteen further coefficients approximately. Analysing these coefficients by a variety of methods we conclude that the OGF behaves as $$S(z) \sim A (1 - μ\cdot z)^γ,$$ where $μ=12.45 \pm 0.15,$ $γ= 1.5 \pm 0.3,$ and $A \approx 0.02$.
In this article, we give a polynomial algorithm to decide whether a given permutation $σ$ is sortable with two stacks in series. This is indeed a longstanding open problem which was first introduced by Knuth. He introduced the stack sorting problem as well as permutation patterns which arises naturally when characterizing permutations that can be sorted with one stack. When several stacks in series are considered, few results are known. There are two main different problems. The first one is the complexity of deciding if a permutation is sortable or not, the second one being the characterizati…
Pop-Stack Sorting is an algorithm that takes a permutation as an input and sorts its elements. It consists of several steps. At one step, the algorithm reads the permutation it has to process from left to right and reverses each of its maximal decreasing subsequences of consecutive elements. It terminates at the first step that outputs the identity permutation. In this note, we answer a question of Defant on the running time of Pop-Stack Sorting on the uniform random permutation $σ_n$. More precisely, we show that there is a constant $c > 0.5$ such that asymptotically almost surely, the algori…
We derive a simple functional equation with two catalytic variables characterising the generating function of 3-stack-sortable permutations. Using this functional equation, we extend the 174-term series to 1000 terms. From this series, we conjecture that the generating function behaves as $$W(t) \sim C_0(1-μ_3 t)^α\cdot \log^β(1-μ_3 t), $$ so that $$[t^n]W(t)=w_n \sim \frac{c_0μ_3^n}{ n^{(α+1)}\cdot \log^λ{n}} ,$$ where $μ_3 = 9.69963634535(30),$ $α= 2.0 \pm 0.25.$ If $α= 2$ exactly, then $λ= -β+1$, and we estimate $β\approx -3.$ If $α$ is not an integer, then $λ=-β$, but we cannot give a usef…
The stack sort algorithm has been the subject of extensive study over the years. In this paper we explore a generalized version of this algorithm where instead of avoiding a single decrease, the stack avoids a set $T$ of permutations. We let $s_T$ denote this map. We classify for which sets $T$ the map $s_T$ is bijective. A corollary to this answers a question of Baril, Cerbai, Khalil, and Vajnovszki about stack sort composed with $s_{\{σ,τ\}}$, known as the $(σ,τ)$-machine. This fully classifies for which $σ$ and $τ$ the preimage of the identity under the $(σ,τ)$-machine is counted by the Cat…
Recently Albert and Bousquet-Mélou \cite{AB15} obtained the solution to the long-standing problem of the number of permutations sortable by two stacks in parallel (tsip). Their solution was expressed in terms of functional equations. We show that the equally long-standing problem of the number of permutations sortable by a double-ended queue (deque) can be simply related to the solution of the same functional equations. Subject to plausible, but unproved, conditions, the radius of convergence of both generating functions is the same. Numerical work confirms this conjecture to 10 significant di…
Let $\mathcal D_n$ denote the average number of iterations of West's stack-sorting map $s$ that are needed to sort a permutation in $S_n$ into the identity permutation $123\cdots n$. We prove that \[0.62433\approxλ\leq\liminf_{n\to\infty}\frac{\mathcal D_n}{n}\leq\limsup_{n\to\infty}\frac{\mathcal D_n}{n}\leq \frac{3}{5}(7-8\log 2)\approx 0.87289,\] where $λ$ is the Golomb-Dickman constant. Our lower bound improves upon West's lower bound of $0.23$, and our upper bound is the first improvement upon the trivial upper bound of $1$. We then show that fertilities of permutations increase monotonic…
We introduce an algorithm to determine when a sorting operation, such as stack-sort or bubble-sort, outputs a given pattern. The algorithm provides a new proof of the description of West-2-stack-sortable permutations, that is permutations that are completely sorted when passed twice through a stack, in terms of patterns. We also solve the long-standing problem of describing West-3-stack-sortable permutations. This requires a new type of generalized permutation pattern we call a decorated pattern.
We study a sorting machine consisting of two stacks in series where the first stack has the added restriction such that entries in the stack must be in decreasing order from top to bottom. We give the basis of the class of permutations that are sortable by this machine which shows that it is enumerated by the Schröder numbers.
The (classical) problem of characterizing and enumerating permutations that can be sorted using two stacks connected in series is still largely open. In the present paper we address a related problem, in which we impose restrictions both on the procedure and on the stacks. More precisely, we consider a greedy algorithm where we perform the rightmost legal operation (here "rightmost" refers to the usual representation of stack sorting problems). Moreover, the first stack is required to be $σ$-avoiding, for some permutation $σ$, meaning that, at each step, the elements maintained in the stack av…
This paper continues the analysis of the pattern-avoiding sorting machines recently introduced by Cerbai, Claesson and Ferrari [CCF]. These devices consist of two stacks, through which a permutation is passed in order to sort it, where the content of each stack must at all times avoid a certain pattern. Here we characterize and enumerate the set of permutations that can be sorted when the first stack is $132$-avoiding, solving one of the open problems proposed in [CCF]. To that end we present several connections with other well known combinatorial objects, such as lattice paths and restricted …
We exhibit a bijection between recently-introduced combinatorial objects known as valid hook configurations and certain weighted set partitions. When restricting our attention to set partitions that are matchings, we obtain three new combinatorial interpretations of Lassalle's sequence. One of these interpretations involves permutations that have exactly one preimage under the (West) stack-sorting map. We prove that the sequences obtained by counting these permutations according to their first entries are symmetric, and we conjecture that they are log-concave. We also obtain new recurrence rel…
Pancake flipping, a famous open problem in computer science, can be formalised as the problem of sorting a permutation of positive integers using as few prefix reversals as possible. In that context, a prefix reversal of length k reverses the order of the first k elements of the permutation. The burnt variant of pancake flipping involves permutations of signed integers, and reversals in that case not only reverse the order of elements but also invert their signs. Although three decades have now passed since the first works on these problems, neither their computational complexity nor the maxim…