2-Stack Sorting is Polynomial
- 130 Downloads
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 characterization and the enumeration of those sortable permutations. We hereby prove that the first problem lies in P by giving a polynomial algorithm to solve it. This article relies on Pierrot and Rossin () in which 2-stack pushall sorting is defined and studied.
KeywordsStack Sort Permutation Pattern Polynomial algorithm Combinatorics Algorithms Permutation patterns Stack-sorting
Compliance with Ethical Standards
Conflict of interests
The authors declare that they have no conflict of interest.
This study was funded by ANR, project ANR BLAN-0204_07 MAGNUM.
- 4.Even, S., Itai, A.: Queues, stacks, and graphs. In: Theory of Machines and Computations, pp 71–86. Academic Press (1971)Google Scholar
- 5.Kitaev, S.: Patterns in permutations and words. Monographs in theoretical computer science. An EATCS Series, Springer (2011)Google Scholar
- 6.Knuth, D. E.: The Art of Computer Programming, Volume I: Fundamental Algorithms. Addison-Wesley (1968)Google Scholar
- 7.Knuth, D. E.: The Art of Computer Programming, Volume III: Sorting and Searching. Addison-Wesley (1973)Google Scholar
- 8.Murphy, M.M.: Restricted Permutations Antichains, Atomic Classes and Stack Sorting. PhD thesis, University of St Andrews (2002)Google Scholar
- 9.Pierrot, A.: Combinatoire et algorithmique dans les classes de permutations. Phd thesis, Université Paris Diderot - Paris 7. (available in English at http://www.normalesup.org/~adpierro/pdf/these_Adeline_Pierrot.pdf) (2013)
- 10.Pierrot, A., Rossin, D.: 2-stack pushall sortable permutations. Preprint available at arXiv:1303.4376 (2013)
- 11.Tarjan, R. E.: Sorting using networks of queues and stacks. J. ACM 19(2) (1972)Google Scholar
- 12.Unger, W.: The complexity of colouring circle graphs (extended abstract). In: Finkel, A., Jantzen, M. (eds.) STACS 92, 9th Annual Symposium on Theoretical Aspects of Computer Science, Cachan, France, February 13–15, 1992, Proceedings, volume 577 of Lecture Notes in Computer Science, pp 389–400. Springer (1992)Google Scholar