Fast algorithms for finding pattern avoiders and counting pattern occurrences in permutations
HTML articles powered by AMS MathViewer
- by William Kuszmaul PDF
- Math. Comp. 87 (2018), 987-1011 Request permission
Abstract:
Given a set $\Pi$ of permutation patterns of length at most $k$, we present an algorithm for building $S_{\le n}(\Pi )$, the set of permutations of length at most $n$ avoiding the patterns in $\Pi$, in time $O(|S_{\le n - 1}(\Pi )| \cdot k + |S_{n}(\Pi )|)$. Additionally, we present an $O(n!k)$-time algorithm for counting the number of copies of patterns from $\Pi$ in each permutation in $S_n$. Surprisingly, when $|\Pi | = 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}(\Pi )|$ or tallying permutations according to $\Pi$-patterns, rather than to store information about every permutation, then all of our algorithms can be implemented in $O(n^{k+1}k)$ space.
Our algorithms extend to considering permutations in any set closed under standardization of subsequences. Our algorithms also partially adapt to considering vincular patterns.
References
- Shlomo Ahal and Yuri Rabinovich, On complexity of the subpattern problem, SIAM J. Discrete Math. 22 (2008), no. 2, 629–649. MR 2399369, DOI 10.1137/S0895480104444776
- Michael Albert, Permlab: Software for permutation patterns, 2012, http://www.cs.otago.ac.nz/PermLab, 2012.
- Michael H. Albert, Robert E. L. Aldred, Mike D. Atkinson, and Derek A. Holton, Algorithms for pattern involvement in permutations, Algorithms and computation (Christchurch, 2001) Lecture Notes in Comput. Sci., vol. 2223, Springer, Berlin, 2001, pp. 355–366. MR 1917756, DOI 10.1007/3-540-45678-3_{3}1
- Eric Babson and Einar Steingrímsson, Generalized permutation patterns and a classification of the Mahonian statistics, Sém. Lothar. Combin. 44 (2000), Art. B44b, 18. MR 1758852
- Jörgen Backelin, Julian West, and Guoce Xin, Wilf-equivalence for singleton classes, Adv. in Appl. Math. 38 (2007), no. 2, 133–148. MR 2290807, DOI 10.1016/j.aam.2004.11.006
- Prosenjit Bose, Jonathan F. Buss, and Anna Lubiw, Pattern matching for permutations, Inform. Process. Lett. 65 (1998), no. 5, 277–283. MR 1620935, DOI 10.1016/S0020-0190(97)00209-3
- Marie-Louise Bruner and Martin Lackner, The computational landscape of permutation patterns, Pure Math. Appl. (PU.M.A.) 24 (2013), no. 2, 83–101. MR 3266905
- Marie-Louise Bruner and Martin Lackner, A fast algorithm for permutation pattern matching based on alternating runs, Algorithmica 75 (2016), no. 1, 84–117. MR 3492057, DOI 10.1007/s00453-015-0013-y
- Anders Claesson, Generalized pattern avoidance, European J. Combin. 22 (2001), no. 7, 961–971. MR 1857258, DOI 10.1006/eujc.2001.0515
- Anders Claesson, Vít Jelínek, and Einar Steingrímsson, Upper bounds for the Stanley-Wilf limit of 1324 and other layered patterns, J. Combin. Theory Ser. A 119 (2012), no. 8, 1680–1691. MR 2946382, DOI 10.1016/j.jcta.2012.05.006
- P. Erdös and G. Szekeres, A combinatorial problem in geometry, Compositio Math. 2 (1935), 463–470. MR 1556929
- Sylvain Guillemot and Dániel Marx, Finding small patterns in permutations in linear time, Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, ACM, New York, 2014, pp. 82–101. MR 3376367, DOI 10.1137/1.9781611973402.7
- Y. Han, S. Saxena, and X. Shen, An efficient parallel algorithm for building the separating tree, Journal of Parallel and Distributed Computing 70 (2010), no. 6, 625–629.
- Y. Han and S. Saxena, Parallel algorithms for testing length four permutations, Parallel Architectures, Algorithms and Programming (PAAP), 2014 Sixth International Symposium on, IEEE, 2014, pp. 81–86.
- Louis Ibarra, Finding pattern matchings for permutations, Inform. Process. Lett. 61 (1997), no. 6, 293–295. MR 1448525, DOI 10.1016/S0020-0190(97)00029-X
- Y. Inoue, T. Takahisa, and S.-I. Minato, Generating sets of permutations with pattern occurrence counts using permutation decision diagrams, TCS Technical Report, Series A 14 (2014), no. 78.
- Y. Inoue, T. Takahisa, and S.-I. Minato, Implicit generation of pattern-avoiding permutations by using permutation decision diagrams, IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences 97 (2014), no. 6, 1171–1179.
- Jinil Kim, Peter Eades, Rudolf Fleischer, Seok-Hee Hong, Costas S. Iliopoulos, Kunsoo Park, Simon J. Puglisi, and Takeshi Tokuyama, Order-preserving matching, Theoret. Comput. Sci. 525 (2014), 68–79. MR 3174114, DOI 10.1016/j.tcs.2013.10.006
- Sergey Kitaev, Patterns in permutations and words, Monographs in Theoretical Computer Science. An EATCS Series, Springer, Heidelberg, 2011. With a foreword by Jeffrey B. Remmel. MR 3012380, DOI 10.1007/978-3-642-17333-2
- Donald E. Knuth, The art of computer programming. Vol. 3, Addison-Wesley, Reading, MA, 1998. Sorting and searching; Second edition [of MR0445948]. MR 3077154
- M. Kubica, T. Kulczyński, J. Radoszewski, W. Rytter, and T. Waleń, A linear time algorithm for consecutive permutation pattern matching, Inform. Process. Lett. 113 (2013), no. 12, 430–433. MR 3042127, DOI 10.1016/j.ipl.2013.03.015
- W. Kuszmaul, Fast algorithms for finding pattern avoiders and counting pattern occurrences in permutations, arXiv preprint arXiv:1509.08216 (2015).
- Adam Marcus and Gábor Tardos, Excluded permutation matrices and the Stanley-Wilf conjecture, J. Combin. Theory Ser. A 107 (2004), no. 1, 153–160. MR 2063960, DOI 10.1016/j.jcta.2004.04.002
- Michal Opler, Major index distribution over permutation classes, Adv. in Appl. Math. 80 (2016), 131–150. MR 3537243, DOI 10.1016/j.aam.2016.06.011
- Rodica Simion and Frank W. Schmidt, Restricted permutations, European J. Combin. 6 (1985), no. 4, 383–406. MR 829358, DOI 10.1016/S0195-6698(85)80052-4
- N. J. A. Sloane, The on-line encyclopedia of integer sequences, Notices Amer. Math. Soc. 50 (2003), no. 8, 912–915. MR 1992789
- W. A. Stein, T. Abbott, M. Abshoff, et al., Sage mathematics software, 2011.
- V. Yugandhar and Sanjeev Saxena, Parallel algorithms for separable permutations, Discrete Appl. Math. 146 (2005), no. 3, 343–364. MR 2115153, DOI 10.1016/j.dam.2004.10.004
Additional Information
- William Kuszmaul
- Affiliation: Department of Computer Science, Stanford University, Stanford, California 94305
- MR Author ID: 997955
- Email: william.kuszmaul@gmail.com
- Received by editor(s): October 6, 2015
- Received by editor(s) in revised form: July 3, 2016, and September 19, 2016
- Published electronically: May 31, 2017
- Additional Notes: This research was conducted at the University of Minnesota Duluth REU and was supported by NSF grant 1358659 and NSA grant H98230-13-1-0273. Machine time was provided by an AWS in Education Research grant.
- © Copyright 2017 American Mathematical Society
- Journal: Math. Comp. 87 (2018), 987-1011
- MSC (2010): Primary 05A05; Secondary 68W01
- DOI: https://doi.org/10.1090/mcom/3216
- MathSciNet review: 3739226