Griddings of Permutations and Hardness of Pattern Matching

Authors Vít Jelínek , Michal Opler , Jakub Pekárek

Thumbnail PDF


  • Filesize: 1.12 MB
  • 22 pages

Document Identifiers

Author Details

Vít Jelínek
  • Computer Science Institute, Charles University, Prague, Czech Republic
Michal Opler
  • Computer Science Institute, Charles University, Prague, Czech Republic
Jakub Pekárek
  • Department of Applied Mathematics, Charles University, Prague, Czech Republic

Cite AsGet BibTex

Vít Jelínek, Michal Opler, and Jakub Pekárek. Griddings of Permutations and Hardness of Pattern Matching. In 46th International Symposium on Mathematical Foundations of Computer Science (MFCS 2021). Leibniz International Proceedings in Informatics (LIPIcs), Volume 202, pp. 65:1-65:22, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2021)


We study the complexity of the decision problem known as Permutation Pattern Matching, or PPM. The input of PPM consists of a pair of permutations τ (the "text") and π (the "pattern"), and the goal is to decide whether τ contains π as a subpermutation. On general inputs, PPM is known to be NP-complete by a result of Bose, Buss and Lubiw. In this paper, we focus on restricted instances of PPM where the text is assumed to avoid a fixed (small) pattern σ; this restriction is known as Av(σ)-PPM. It has been previously shown that Av(σ)-PPM is polynomial for any σ of size at most 3, while it is NP-hard for any σ containing a monotone subsequence of length four. In this paper, we present a new hardness reduction which allows us to show, in a uniform way, that Av(σ)-PPM is hard for every σ of size at least 6, for every σ of size 5 except the symmetry class of 41352, as well as for every σ symmetric to one of the three permutations 4321, 4312 and 4231. Moreover, assuming the exponential time hypothesis, none of these hard cases of Av(σ)-PPM can be solved in time 2^o(n/log n). Previously, such conditional lower bound was not known even for the unconstrained PPM problem. On the tractability side, we combine the CSP approach of Guillemot and Marx with the structural results of Huczynska and Vatter to show that for any monotone-griddable permutation class 𝒞, PPM is polynomial when the text is restricted to a permutation from 𝒞.

Subject Classification

ACM Subject Classification
  • Mathematics of computing → Permutations and combinations
  • Theory of computation → Pattern matching
  • Theory of computation → Problems, reductions and completeness
  • Permutation
  • pattern matching
  • NP-hardness


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Shlomo Ahal and Yuri Rabinovich. On complexity of the subpattern problem. SIAM J. Discrete Math., 22(2):629-649, 2008. URL:
  2. Michael Albert, Marie-Louise Lackner, Martin Lackner, and Vincent Vatter. The complexity of pattern matching for 321-avoiding and skew-merged permutations. Discrete Math. Theor. Comput. Sci., 18(2):Paper No. 11, 17, 2016. URL:
  3. Michael H. Albert, M. D. Atkinson, Mathilde Bouvel, Nik Ruškuc, and Vincent Vatter. Geometric grid classes of permutations. Trans. Amer. Math. Soc., 365(11):5859-5881, 2013. URL:
  4. Ragnar Pall Ardal, Tomas Ken Magnusson, Émile Nadeau, Bjarni Jens Kristinsson, Bjarki Agust Gudmundsson, Christian Bean, Henning Ulfarsson, Jon Steinn Eliasson, Murray Tannock, Alfur Birkir Bjarnason, Jay Pantone, and Arnar Bjarni Arnarson. Permuta, 2021. URL:
  5. Benjamin Aram Berendsohn. Complexity of permutation pattern matching. Master’s thesis, Freie Universität Berlin, Berlin, 2019. URL:
  6. Benjamin Aram Berendsohn, László Kozma, and Dániel Marx. Finding and counting permutations via CSPs. In Bart M. P. Jansen and Jan Arne Telle, editors, 14th International Symposium on Parameterized and Exact Computation, IPEC 2019, September 11-13, 2019, Munich, Germany, volume 148 of LIPIcs, pages 1:1-1:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2019. URL:
  7. Prosenjit Bose, Jonathan F. Buss, and Anna Lubiw. Pattern matching for permutations. Inform. Process. Lett., 65(5):277-283, 1998. URL:
  8. Marie-Louise Bruner and Martin Lackner. A fast algorithm for permutation pattern matching based on alternating runs. Algorithmica, 75(1):84-117, 2016. URL:
  9. P. Erdős and G. Szekeres. A combinatorial problem in geometry. Compositio Math., 2:463-470, 1935. URL:
  10. Jacob Fox. Stanley-Wilf limits are typically exponential., 2013.
  11. Sylvain Guillemot and Dániel Marx. Finding small patterns in permutations in linear time. In Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 82-101. ACM, New York, 2014. URL:
  12. Sylvain Guillemot and Stéphane Vialette. Pattern matching for 321-avoiding permutations. In Algorithms and computation, volume 5878 of Lecture Notes in Comput. Sci., pages 1064-1073. Springer, Berlin, 2009. URL:
  13. Sophie Huczynska and Vincent Vatter. Grid classes and the Fibonacci dichotomy for restricted permutations. Electron. J. Combin., 13(1):Research Paper 54, 14, 2006. URL:
  14. Russell Impagliazzo and Ramamohan Paturi. On the complexity of k-SAT. J. Comput. System Sci., 62(2):367-375, 2001. Special issue on the Fourteenth Annual IEEE Conference on Computational Complexity (Atlanta, GA, 1999). URL:
  15. Vít Jelínek and Jan Kynčl. Hardness of permutation pattern matching. In Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 378-396. SIAM, Philadelphia, PA, 2017. URL:
  16. Vít Jelínek, Michal Opler, and Jakub Pekárek. A complexity dichotomy for permutation pattern matching on grid classes. In Javier Esparza and Daniel Král', editors, 45th International Symposium on Mathematical Foundations of Computer Science, MFCS 2020, August 24-28, 2020, Prague, Czech Republic, volume 170 of LIPIcs, pages 52:1-52:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2020. URL:
  17. C. Schensted. Longest increasing and decreasing subsequences. Canad. J. Math., 13:179-191, 1961. URL:
  18. Vincent Vatter and Steve Waton. On partial well-order for monotone grid classes of permutations. Order, 28(2):193-199, 2011. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail