We prove a lower and an upper bound on the number of block moves necessary to sort a permutation. We put our results in contrast with existing results on sorting by block transpositions, and raise some open questions.
We show that the number of members of S_n avoiding any one of five specific triples of 4-letter patterns is given by sequence A111279 in OEIS, which is known to count weak sorting permutations. By numerical evidence, there are no other (non-trivial) triples of 4-letter patterns giving rise to this sequence. We make use of a variety of methods in proving our result, including recurrences, the kernel method, direct counting, and bijections.
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 prove that the Mahonian-Stirling pairs of permutation statistics $(\sor, \cyc)$ and $(\inv, \mathrm{rlmin})$ are equidistributed on the set of permutations that correspond to arrangements of $n$ non-atacking rooks on a Ferrers board with $n$ rows and $n$ columns. The proofs are combinatorial and use bijections between matchings and Dyck paths and a new statistic, sorting index for matchings, that we define. We also prove a refinement of this equidistribution result which describes the minimal elements in the permutation cycles and the right-to-left minimum letters. Moreover, we define a sor…
Permutation sorting, one of the fundamental steps in pre-processing data for the efficient application of other algorithms, has a long history in mathematical research literature and has numerous applications. Two special-purpose sorting operations are considered in this paper: context directed swap, abbreviated cds, and context directed reversal, abbreviated cdr. These are special cases of sorting operations that were studied in prior work on permutation sorting. Moreover, cds and cdr have been postulated to model molecular sorting events that occur in the genome maintenance program of certai…
In this paper we examine the sorting operator $T(LnR)=T(R)T(L)n$. Applying this operator to a permutation is equivalent to passing the permutation reversed through a stack. We prove theorems that characterise $t$-revstack sortability in terms of patterns in a permutation that we call $zigzag$ patterns. Using these theorems we characterise those permutations of length $n$ which are sorted by $t$ applications of $T$ for $t=0,1,2,n-3,n-2,n-1$. We derive expressions for the descent polynomials of these six classes of permutations and use this information to prove Steingrímsson's sorting conjecture…
We introduce a game on graphs. By a theorem of Zermelo, each instance of the game on a finite graph is determined. While the general decision problem on which player has a winning strategy in a given instance of the game is unsolved, we solve the decision problem for a specific class of finite graphs. This result is then applied to a permutation sorting game to prove the optimality of a proportional bound under which TWO has a winning strategy.
We consider the problem of determining the maximum number of moves required to sort a permutation of $[n]$ using cut-and-paste operations, in which a segment is cut out and then pasted into the remaining string, possibly reversed. We give short proofs that every permutation of $[n]$ can be transformed to the identity in at most $\flr{2n/3}$ such moves and that some permutations require at least $\flr{n/2}$ moves.
Patience Sorting is a combinatorial algorithm that can be viewed as an iterated, non-recursive form of the Schensted Insertion Algorithm. In recent work the authors have shown that Patience Sorting provides an algorithmic description for permutations avoiding the barred (generalized) permutation pattern $3-\bar{1}-42$. Motivated by this and a recently formulated geometric form for Patience Sorting in terms of certain intersecting lattice paths, we study the related themes of restricted input and avoidance of similar barred permutation patterns. One such result is to characterize those permutat…
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 …
The special purpose sorting operation, context directed swap (CDS), is an example of the block interchange sorting operation studied in prior work on permutation sorting. CDS has been postulated to model certain molecular sorting events that occur in the genome maintenance program of some species of ciliates. We investigate the mathematical structure of permutations not sortable by the CDS sorting operation. In particular, we present substantial progress towards quantifying permutations with a given strategic pile size, which can be understood as a measure of CDS non-sortability. Our main resu…
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.
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 …
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.
We study sorting by queues that can rearrange their content by applying permutations from a predefined set. These new sorting devices are called shuffle queues and we investigate those of them corresponding to sets of permutations defining some well-known shuffling methods. If $\mathbb{Q}_Σ$ is the shuffle queue corresponding to the shuffling method $Σ$, then we find a number of surprising results related to two natural variations of shuffle queues denoted by $\mathbb{Q}_Σ^{\prime}$ and $\mathbb{Q}_Σ^{\textsf{pop}}$. These require the entire content of the device to be unloaded after a permuta…
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$.
We study a sorting procedure (run-sorting) on permutations, where runs are rearranged in lexicographic order. We describe a rather surprising bijection on permutations on length $n$, with the property that it sends the set of peak-values to the set of peak-values after run-sorting. We also prove that the expected number of descents in a permutation $σ\in S_{n}$ after run-sorting is equal to $(n-2)/3$. Moreover, we provide a closed form of the exponential generating function introduced by Nabawanda, Rakotondrajao and Bamunoba in 2020, for the number of run-sorted permutations of $[n]$, ($RSP(n)…
Computing the reversal distances of signed permutations is an important topic in Bioinformatics. Recently, a new lower bound for the reversal distance was obtained via the plane permutation framework. This lower bound appears different from the existing lower bound obtained by Bafna and Pevzner through breakpoint graphs. In this paper, we prove that the two lower bounds are equal. Moreover, we confirm a related conjecture on skew-symmetric plane permutations, which can be restated as follows: let $p=(0,-1,-2,\ldots -n,n,n-1,\ldots 1)$ and let $$ \tilde{s}=(0,a_1,a_2,\ldots a_n,-a_n,-a_{n-1},\l…
We define a new statistic $\mathsf{sor}$ on the set of colored permutations $\mathsf{G}_{r,n}$ and prove that it has the same distribution as the length function. For the set of restricted colored permutations corresponding to the arrangements of $n$ non-attacking rooks on a fixed Ferrers shape we show that the following two sequences of set-valued statistics are joint equidistributed: $(\ell,\mathsf{Rmil}^0,\mathsf{Rmil}^1,...,\mathsf{Rmil}^{r-1}$, $\mathsf{Lmil}^0,\mathsf{Lmil}^1,...,\mathsf{Lmil}^{r-1}$, $\mathsf{Lmal}^0,\mathsf{Lmal}^1,...,\mathsf{Lmal}^{r-1}$, $\mathsf{Lmap}^0,\mathsf{Lma…
Despite having been introduced in 1962 by C.L. Mallows, the combinatorial algorithm Patience Sorting is only now beginning to receive significant attention due to such recent deep results as the Baik-Deift-Johansson Theorem that connect it to fields including Probabilistic Combinatorics and Random Matrix Theory. The aim of this work is to develop some of the more basic combinatorics of the Patience Sorting Algorithm. In particular, we exploit the similarities between Patience Sorting and the Schensted Insertion Algorithm in order to do things that include defining an analog of the Knuth relati…
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…
In the combinatorial study of the coefficients of a bivariate polynomial that generalizes both the length and the reflection length generating functions for finite Coxeter groups, Petersen introduced a new Mahonian statistic $sor$, called the sorting index. Petersen proved that the pairs of statistics $(sor,cyc)$ and $(inv,rl\textrm{-}min)$ have the same joint distribution over the symmetric group, and asked for a combinatorial proof of this fact. In answer to the question of Petersen, we observe a connection between the sorting index and the B-code of a permutation defined by Foata and Han, a…
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 sorting operators $\mathbf{A}$ on permutations that are obtained composing Knuth's stack sorting operator $\mathbf{S}$ and the reversal operator $\mathbf{R}$, as many times as desired. For any such operator $\mathbf{A}$, we provide a size-preserving bijection between the set of permutations sorted by $\mathbf{S} \circ \mathbf{A}$ and the set of those sorted by $\mathbf{S} \circ \mathbf{R} \circ \mathbf{A}$, proving that these sets are enumerated by the same sequence, but also that many classical permutation statistics are equidistributed across these two sets. The description of this …
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…
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…
A sequence of reversals that takes a signed permutation to the identity is perfect if at no step a common interval is broken. Determining a parsimonious perfect sequence of reversals that sorts a signed permutation is NP-hard. Here we show that, despite this worst-case analysis, with probability one, sorting can be done in polynomial time. Further, we find asymptotic expressions for the average length and number of reversals in commuting permutations, an interesting sub-class of signed permutations.
This paper initiates a limit theory of permutation valued processes, building on the recent theory of permutons. We apply this to study the asymptotic behaviour of random sorting networks. We prove that the Archimedean path, the conjectured limit of random sorting networks, is the unique path from the identity to the reverse permuton having minimal energy in an appropriate metric. Together with a recent large deviations result (Kotowski, 2016), it implies the Archimedean limit for the model of relaxed random sorting networks.
We give a positive answer to a question raised by Davis et al. ({\em Discrete Mathematics} 341, 2018), concerning permutations with the same pinnacle set. Given $π\in S_n$, a {\em pinnacle} of $π$ is an element $π_i$ ($i\neq 1,n$) such that $π_{i-1}<π_i>π_{i+1}$. The question is: given $π,π'\in S_n$ with the same pinnacle set $S$, is there a sequence of operations that transforms $π$ into $π'$ such that all the intermediate permutations have pinnacle set $S$? We introduce {\em balanced reversals}, defined as reversals that do not modify the pinnacle set of the permutation to which they are app…
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 …
In 1966, Claude Berge proposed the following sorting problem. Given a string of $n$ alternating white and black pegs on a one-dimensional board consisting of an unlimited number of empty holes, rearrange the pegs into a string consisting of $\lceil\frac{n}{2}\rceil$ white pegs followed immediately by $\lfloor\frac{n}{2}\rfloor$ black pegs (or vice versa) using only moves which take 2 adjacent pegs to 2 vacant adjacent holes. Avis and Deza proved that the alternating string can be sorted in $\lceil\frac{n}{2}\rceil$ such {\em Berge 2-moves} for $n\geq 5$. Extending Berge's original problem, we …
We describe an algorithm, implemented in Python, which can enumerate any permutation class with polynomial enumeration from a structural description of the class. In particular, this allows us to find formulas for the number of permutations of length n which can be obtained by a finite number of block sorting operations (e.g., reversals, block transpositions, cut-and-paste moves).
In this paper we present a simple framework to study various distance problems of permutations, including the transposition and block-interchange distance of permutations as well as the reversal distance of signed permutations. These problems are very important in the study of the evolution of genomes. We give a general formulation for lower bounds of the transposition and block-interchange distance from which the existing lower bounds obtained by Bafna and Pevzner, and Christie can be easily derived. As to the reversal distance of signed permutations, we translate it into a block-interchange …
Perfect sorting by reversals, a problem originating in computational genomics, is the process of sorting a signed permutation to either the identity or to the reversed identity permutation, by a sequence of reversals that do not break any common interval. Bérard et al. (2007) make use of strong interval trees to describe an algorithm for sorting signed permutations by reversals. Combinatorial properties of this family of trees are essential to the algorithm analysis. Here, we use the expected value of certain tree parameters to prove that the average run-time of the algorithm is at worst, poly…
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.
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…
A sorting network is a shortest path from 12...n to n...21 in the Cayley graph of S_n generated by nearest-neighbour swaps. We prove that for a uniform random sorting network, as n->infinity the space-time process of swaps converges to the product of semicircle law and Lebesgue measure. We conjecture that the trajectories of individual particles converge to random sine curves, while the permutation matrix at half-time converges to the projected surface measure of the 2-sphere. We prove that, in the limit, the trajectories are Holder-1/2 continuous, while the support of the permutation matrix l…
Let $s$ denote West's stack-sorting map. A permutation is called $t-\textit{sorted}$ if it is of the form $s^t(μ)$ for some permutation $μ$. We prove that the maximum number of descents that a $t$-sorted permutation of length $n$ can have is $\left\lfloor\frac{n-t}{2}\right\rfloor$. When $n$ and $t$ have the same parity and $t\geq 2$, we give a simple characterization of those $t$-sorted permutations in $S_n$ that attain this maximum. In particular, the number of such permutations is $(n-t-1)!!$.
In genome rearrangements, the mutational event transposition swaps two adjacent blocks of genes in one chromosome. The Transposition Distance Problem (TDP) aims to find the minimum number of transpositions required to transform one chromosome into another, both represented as permutations. The TDP can be reduced to the problem of Sorting by Transpositions (SBT). SBT is $\mathcal{NP}$-hard and the best approximation algorithm with a $1.375$ ratio was proposed by Elias and Hartman. Their algorithm employs simplification, a technique used to transform an input permutation $π$ into a simple permut…
We introduce a sorting machine consisting of $k+1$ stacks in series: the first $k$ stacks can only contain elements in decreasing order from top to bottom, while the last one has the opposite restriction. This device generalizes \cite{SM}, which studies the case $k=1$. Here we show that, for $k=2$, the set of sortable permutations is a class with infinite basis, by explicitly finding an antichain of minimal nonsortable permutations. This construction can easily be adapted to each $k \ge 3$. Next we describe an optimal sorting algorithm, again for the case $k=2$. We then analyze two types of le…
Consider a finite sequence of permutations of the elements 1,...,n, with the property that each element changes its position by at most 1 from any permutation to the next. We call such a sequence a tangle, and we define a move of element i to be a maximal subsequence of at least two consecutive permutations during which its positions form an arithmetic progression of common difference +1 or -1. We prove that for any initial and final permutations, there is a tangle connecting them in which each element makes at most 5 moves, and another in which the total number of moves is at most 4n. On the …
A sorting network (also known as a reduced decomposition of the reverse permutation), is a shortest path from $12 \cdots n$ to $n \cdots 21$ in the Cayley graph of the symmetric group $S_n$ generated by adjacent transpositions. We prove that in a uniform random $n$-element sorting network $σ^n$, all particle trajectories are close to sine curves with high probability. We also find the weak limit of the time-$t$ permutation matrix measures of $σ^n$. As a corollary of these results, we show that if $S_n$ is embedded into $\mathbb{R}^n$ via the map $τ\mapsto (τ(1), τ(2), \dots τ(n))$, then with h…
Let $s$ denote West's stack-sorting map. For all positive integers $m$ and all integers $n\geq 2m-2$, we give a simple characterization of the set $s^{n-m}(S_n)$; as a consequence, we find that $|s^{n-m}(S_n)|$ is the $m^\text{th}$ Bell number $B_m$. We also prove that the restriction $n\geq 2m-2$ is tight by showing that $|s^{m-3}(S_{2m-3})|=B_m+m-2$ for all $m\geq 3$.