Fertility monotonicity and average complexity of the stack-sorting map
Introduction
Motivated by a problem involving sorting railroad cars, Knuth introduced a certain “stack-sorting” machine in his book The Art of Computer Programming [22]. Knuth’s analysis of this sorting machine led to several advances in combinatorics, including the notion of a permutation pattern and the kernel method [4], [6], [21], [24]. In his 1990 Ph.D. dissertation, West defined a deterministic variant of Knuth’s machine. This variant, which is a function that we denote by , has now received a huge amount of attention (see [5], [6], [14], [15] and the references therein). West’s original definition makes use of a stack that is allowed to hold entries from a permutation. Here, a permutation is an ordering of a finite set of integers, written in one-line notation. Let denote the set of permutations of the set . Assume we are given an input permutation . Throughout this procedure, if the next entry in the input permutation is smaller than the entry at the top of the stack or if the stack is empty, the next entry in the input permutation is placed at the top of the stack. Otherwise, the entry at the top of the stack is annexed to the end of the growing output permutation. This procedure stops when the output permutation has length . We then define to be this output permutation. Fig. 1 illustrates this procedure and shows that .
There is also a simple recursive definition of the map . First, we declare that sends the empty permutation to itself. Given a nonempty permutation , we can write , where is the largest entry in . We then define . For example,
One of the central notions in the investigation of the stack-sorting map is that of a -stack-sortable permutation, which is a permutation such that is increasing ( is the -fold iterate of ). Let be the number of -stack-sortable permutations in . The stack-sorting map moves the largest entry in a permutation to the end, so a simple inductive argument shows that every permutation of length is -stack-sortable. It follows from Knuth’s analysis of his stack-sorting machine that the -stack-sortable permutations are precisely the permutations that avoid the pattern . Thus, is the Catalan number . Settling a conjecture of West, Zeilberger [30] proved that . The current author has obtained nontrivial asymptotic lower bounds for for every fixed , and he has obtained nontrivial asymptotic upper bounds for and [13], [15]. He has also devised a polynomial-time algorithm for computing [15]. Instead of focusing only on -stack-sortable permutations when is small and fixed, West realized that he could make progress if he attacked from the other side. He considered the cases and . He showed that a permutation in is -stack-sortable if and only if it does not end in the suffix [29]. He also characterized and enumerated -stack-sortable permutations in . The case was treated in [8].
Define the stack-sorting tree on to be the rooted tree with vertex set in which the root is the identity permutation and in which each nonidentity permutation is a child of . The stack-sorting depth of a permutation , which we denote by , is the depth of in this tree. Equivalently, is the smallest nonnegative integer such that is -stack-sortable. It is natural to view as a sorting algorithm that acts iteratively on an input permutation until reaching an increasing permutation. It requires elementary operations to apply the map to a permutation in , so is the time complexity of on the input . We are interested in the quantity which is the average depth of the stack-sorting tree on . Note that is the average time complexity of the sorting algorithm that iteratively applies . West [29] proved that where the upper bound of follows from the observation that for all . He also commented that it would probably not be possible to obtain a lower bound larger than or an upper bound smaller than via his pattern-avoidance approach to the problem. Our first main result is as follows.
Theorem 1.1 We have where is the Golomb–Dickman constant.
Another crucial notion in the study of the stack-sorting map is that of the fertility of a permutation , which is simply . Many problems concerning the stack-sorting map can be phrased in terms of fertilities. For example, computing is equivalent to finding the sum of the fertilities of all of the -avoiding (i.e., -stack-sortable) permutations in . The author found methods for computing fertilities of permutations [12], [13], [15], which led to the above-mentioned advancements in the investigation of -stack-sortable permutations when . Permutations with fertility (called uniquely sorted permutations) possess some remarkable enumerative properties [14], [16], [25]. There is also a surprising connection between fertilities of permutations and a formula that converts from free to classical cumulants in noncommutative probability theory [11]; the author has used this connection to prove new results about the map .
In Exercise 23 of Chapter 8 in [6], Bóna asks the reader to find the element of with the largest fertility. As one might expect, the answer is . The proof is not too difficult, but it is also not trivial. Our second main theorem generalizes this result by showing that the fertility statistic is strictly monotonically increasing as one moves up the stack-sorting tree.
Theorem 1.2 For every permutation , we have where equality holds if and only if .
Theorem 1.2 represents a step toward a law-of-diminishing-returns philosophy for the stack-sorting map that Miklós Bóna has postulated. Roughly speaking, his idea is that each successive iteration of the stack-sorting map should be less efficient in sorting permutations than the previous iterations. A concrete formulation of this idea manifests itself in Bóna’s conjecture that for each fixed , the sequence is log-concave (meaning for all ) [7]. Said differently, Bóna’s conjecture states that the average fertility of a -stack-sortable permutation in is at most the average fertility of a -stack-sortable permutation in . While Theorem 1.2 does not imply this conjecture, it is a step in the right direction.
Remark 1.3 Suppose , and let . If , let be the permutation obtained from by swapping the positions of the entries and . If , let . If appears to the left of in , let be the permutation obtained by swapping the positions of and in . Otherwise, let . The right weak order on is the partial order on defined by saying that if there exists a sequence of elements of such that . The left weak order on is the partial order on defined by saying that if there exists a sequence of elements of such that . Theorem 1.2 is a little bit strange in view of the relationship between the stack-sorting map and these two partial orders. It is not difficult to show that for every permutation , we have . Therefore, one might expect to prove Theorem 1.2 by first establishing that whenever . However, this turns out to be false. We have , but one can show that . On the other hand, we will be able to prove (see Theorem 3.3) that Unfortunately, this inequality does not immediately imply Theorem 1.2 because the left weak order is not compatible with the action of the stack-sorting map. To see this, note that . Our proof of Theorem 1.2 will combine (1) with the Decomposition Lemma proved in [15].
Section snippets
Preliminary results
Let us begin this section with some basic terminology. The normalization of a permutation is the permutation in obtained by replacing the -smallest entry in with for all . For example, the normalization of is . We say two permutations have the same relative order if their normalizations are equal. We will tacitly use the fact, which is clear from either definition of the stack-sorting map, that and have the same relative order whenever and have the same
Fertility monotonicity
We now shift our focus to Theorem 1.2. In this section, it will be helpful to make use of the plot of a permutation , which is the diagram showing the points for all . A hook of is a rotated L shape connecting two points and with and , as in Fig. 2. The point is the southwest endpoint of the hook, and is the northeast endpoint of the hook. Let be the set of hooks of with southwest endpoint . For example, Fig. 2 shows
Average depth
In the first part of the paper, we established improved asymptotic estimates for the average depth in the stack-sorting tree on (equivalently, for the average time complexity of the algorithm that sorts via iterating ). Note, however, that it is still not known if the limit exists. West [29] conjectured that this limit does exist; it would be exciting to have a proof of this conjecture.
We computed for random permutations in . The average of for these
Acknowledgments
The author thanks the anonymous referees for helpful comments. The author was supported by a Fannie and John Hertz Foundation Fellowship, United States of America and a National Science Foundation (United States of America) Graduate Research Fellowship (grant no. DGE-1656466).
References (30)
- et al.
Generating functions for generating trees
Discrete Math.
(2002) - et al.
Enumerating permutations sortable by passes through a pop-stack
Adv. Appl. Math.
(2019) noncollinear points determine at least directions
J. Combin. Theory Ser. A
(1982)A proof of Julian West’s conjecture that the number of two-stack-sortable permutations of length is
Discrete Math.
(1992)- et al.
Pop-stack sorting and its image: Permutations with overlapping runs
Acta Math. Univ. Comenian. (N.S.)
(2019) - A. Asinowski, C. Banderier, B. Hackl, Flip-sort and combinatorial aspects of pop-stack sorting,...
- et al.
On pop-stacks in series
Util. Math.
(1981) A survey of stack-sorting disciplines
Electron. J. Combin.
(2003)Combinatorics of Permutations
(2012)A survey of stack sortable permutations
Permutations sortable by passes through a stack
Ann. Combin.
Postorder preimages
Discrete Math. Theor. Comput. Sci.
Preimages under the stack-sorting algorithm
Graphs Combin.
Cited by (17)
Troupes, cumulants, and stack-sorting
2022, Advances in MathematicsPreimages under the Queuesort algorithm
2021, Discrete MathematicsFertilitopes
2023, Discrete and Computational GeometryA LIFT OF WEST’S STACK-SORTING MAP TO PARTITION DIAGRAMS
2023, Pacific Journal of Mathematics