Algorithmica

, Volume 75, Issue 1, pp 84–117 | Cite as

A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs

Article
  • 187 Downloads

Abstract

The NP-complete Permutation Pattern Matching problem asks whether a k-permutation P is contained in a n-permutation T as a pattern. This is the case if there exists an order-preserving embedding of P into T. In this paper, we present a fixed-parameter algorithm solving this problem with a worst-case runtime of \({\mathcal O}(1.79^{\mathsf {run}(T)}\cdot n\cdot k)\), where \(\mathsf {run}(T)\) denotes the number of alternating runs of T. This algorithm is particularly well-suited for instances where T has few runs, i.e., few ups and downs. Moreover, since \(\mathsf {run}(T)<n\), this can be seen as a \({\mathcal O}(1.79^{n}\cdot n\cdot k)\) algorithm which is the first to beat the exponential \(2^n\) runtime of brute-force search. Furthermore, we prove that under standard complexity theoretic assumptions such a fixed-parameter tractability result is not possible for \(\mathsf {run}(P)\).

Keywords

Permutation patterns Parameterized complexity Pattern matching Fixed-parameter tractability Exponential algorithms Combinatorics 

Notes

Acknowledgments

We would like to thank the anonymous reviewers for their feedback and suggestions leading to numerous improvements of this paper. The first author was supported by the Austrian Science Foundation FWF, Grant P25337-N23, the second author by the Austrian Science Foundation FWF, Grant P25518-N23 and Y698.

References

  1. 1.
    Ahal, S., Rabinovich, Y.: On complexity of the subpattern problem. SIAM J. Discrete Math. 22(2), 629–649 (2008)MathSciNetCrossRefMATHGoogle Scholar
  2. 2.
    Albert, M., Aldred, R., Atkinson, M., Holton, D.: Algorithms for pattern involvement in permutations. In: Eades, P., Takaoka, T. (eds.) Algorithms and Computation, Lecture Notes in Computer Science, vol. 2223, pp. 355–367. Springer, Berlin (2001)Google Scholar
  3. 3.
    Albert, M.H., Aldred, R.E.L., Atkinson, M.D., van Ditmarsch, H.P., Handley, B.D., Handley, C.C., Opatrny, J.: Longest subsequences in permutations. Australas. J. Comb. 28, 225–238 (2003)MathSciNetMATHGoogle Scholar
  4. 4.
    André, D.: Étude sur les maxima, minima et séquences des permutations. Annales scientifiques de l’École normale supérieure 3(1), 121–135 (1884)Google Scholar
  5. 5.
    Bóna, M.: Combinatorics of Permutations. Discrete Mathematics and Its Applications. Chapman & Hall/CRC, Boca Raton (2004)CrossRefGoogle Scholar
  6. 6.
    Bose, P., Buss, J.F., Lubiw, A.: Pattern matching for permutations. Inf. Process. Lett. 65(5), 277–283 (1998)MathSciNetCrossRefGoogle Scholar
  7. 7.
    Bouvel, M., Rossin, D.: The longest common pattern problem for two permutations. Pure Math. Appl. 17(1–2), 55–69 (2006)MathSciNetMATHGoogle Scholar
  8. 8.
    Bouvel, M., Rossin, D., Vialette, S.: Longest common separable pattern among permutations. In: Ma, B., Zhang, K. (eds.) Combinatorial Pattern Matching, Lecture Notes in Computer Science, pp. 316–327. Springer, Berlin (2007)CrossRefGoogle Scholar
  9. 9.
    Bruner, M.L., Lackner, M.: A fast algorithm for permutation pattern matching based on alternating runs. In: Fomin, F.V., Kaski, P. (eds.) Algorithm Theory—SWAT 2012, Lecture Notes in Computer Science, vol. 7357, pp. 261–270. Springer, Berlin (2012)Google Scholar
  10. 10.
    Bruner, M.L., Lackner, M.: The computational landscape of permutation patterns. Pure Math. Appl. 24(2), 83–101 (2013)MathSciNetMATHGoogle Scholar
  11. 11.
    Chang, M.S., Wang, F.H.: Efficient algorithms for the maximum weight clique and maximum weight independent set problems on permutation graphs. Inf. Process. Lett. 43(6), 293–295 (1992)MathSciNetCrossRefMATHGoogle Scholar
  12. 12.
    Crochemore, M., Iliopoulos, C.S., Kociumaka, T., Kubica, M., Langiu, A., Pissis, S.P., Radoszewski, J., Rytter, W., Waleń, T.: Order-preserving incomplete suffix trees and order-preserving indexes. In: Kurland, O., Lewenstein, M., Porat, E. (eds.) String Processing and Information Retrieval, Lecture Notes in Computer Science, vol. 8214, pp. 84–95. Springer, Berlin (2013)CrossRefGoogle Scholar
  13. 13.
    David, F.N., Barton, D.E.: Combinatorial Chance. Griffin, London (1962)Google Scholar
  14. 14.
    Downey, R., Fellows, M.: Fundamentals of Parameterized Complexity. Texts in Computer Science. Springer, Berlin (2013)CrossRefMATHGoogle Scholar
  15. 15.
    Downey, R.G., Fellows, M.R.: Parameterized Complexity. Springer, Berlin (1999)CrossRefMATHGoogle Scholar
  16. 16.
    Flajolet, P., Sedgewick, R.: Analytic Combinatorics. Cambridge University Press, Cambridge (2009)CrossRefMATHGoogle Scholar
  17. 17.
    Flum, J., Grohe, M.: Parameterized Complexity Theory. Springer, Berlin (2006)MATHGoogle Scholar
  18. 18.
    Fomin, F., Kratsch, D.: Exact Exponential Algorithms. Texts in Theoretical Computer Science. An EATCS Series. Springer, Berlin (2010)Google Scholar
  19. 19.
    Gawrychowski, P., Uznański, P.: Order-preserving pattern matching with \(k\) mismatches. In: Kulikov, A.S., Kuznetsov, S.O., Pevzner, P. (eds.) Combinatorial Pattern Matching, Lecture Notes in Computer Science, vol. 8486, pp. 130–139. Springer, Berlin (2014)Google Scholar
  20. 20.
    Guillemot, S., Marx, D.: Finding small patterns in permutations in linear time. In: Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA’14, pp. 82–101. SIAM (2014)Google Scholar
  21. 21.
    Guillemot, S., Vialette, S.: Pattern matching for 321-avoiding permutations. In: Dong, Y., Du, D.Z., Ibarra, O. (eds.) Algorithms and Computation, Lecture Notes in Computer Science, vol. 5878, pp. 1064–1073. Springer, Berlin (2009)Google Scholar
  22. 22.
    Guo, J., Niedermeier, R.: Invitation to data reduction and problem kernelization. SIGACT News 38(1), 31–45 (2007)CrossRefGoogle Scholar
  23. 23.
    Ibarra, L.: Finding pattern matchings for permutations. Inf. Process. Lett. 61(6), 293–295 (1997)MathSciNetCrossRefGoogle Scholar
  24. 24.
    Kim, J., Eades, P., Fleischer, R., Hong, S.H., Iliopoulos, C.S., Park, K., Puglisi, S.J., Tokuyama, T.: Order-preserving matching. Theor. Comput. Sci. 525, 68–79 (2014)MathSciNetCrossRefMATHGoogle Scholar
  25. 25.
    Kitaev, S.: Patterns in Permutations and Words. Springer, Berlin (2011)CrossRefMATHGoogle Scholar
  26. 26.
    Klenke, A.: Probability Theory: A Comprehensive Course. Springer, Berlin (2008)CrossRefMATHGoogle Scholar
  27. 27.
    Knuth, D.E.: The Art of Computer Programming: Fundamental Algorithms, vol. I. Addison-Wesley, Reading (1968)MATHGoogle Scholar
  28. 28.
    Kubica, M., Kulczyński, T., Radoszewski, J., Rytter, W., Wale, T.: A linear time algorithm for consecutive permutation pattern matching. Inf. Process. Lett. 113(12), 430–433 (2013)MathSciNetCrossRefMATHGoogle Scholar
  29. 29.
    Levene, H., Wolfowitz, J.: The covariance matrix of runs up and down. Ann. Math. Stat. 15(1), 58–69 (1944)MathSciNetCrossRefMATHGoogle Scholar
  30. 30.
    Mäkinen, E.: On the longest upsequence problem for permutations. Int. J. Comput. Math. 77(1), 45–53 (2001)MathSciNetCrossRefMATHGoogle Scholar
  31. 31.
    Niedermeier, R.: Invitation to Fixed-Parameter Algorithms, Lecture Series in Mathematics and Its Applications. Oxford University Press, Oxford (2006)CrossRefGoogle Scholar
  32. 32.
    Saxena, S., Yugandhar, V.: Parallel algorithms for separable permutations. Discrete Appl. Math. 146(3), 343–364 (2005)MathSciNetCrossRefMATHGoogle Scholar
  33. 33.
    Schensted, C.: Longest increasing and decreasing subsequences. Canad. J. Math. 13,179–191(1961)Google Scholar
  34. 34.
    Simion, R., Schmidt, F.W.: Restricted permutations. Eur. J. Comb. 6, 383–406 (1985)MathSciNetCrossRefMATHGoogle Scholar
  35. 35.
    Van Emde Boas, P.: Machine models and simulations. In: Van Leeuwen, J. (ed.) Handbook of Theoretical Computer Science, vol. A. Elsevier, Amsterdam (1990)Google Scholar
  36. 36.
    Vatter, V.: Permutation patterns. In: Bóna, M. (ed.) Handbook of Enumerative Combinatorics. CRC Press, Boca Raton (2015)Google Scholar

Copyright information

© Springer Science+Business Media New York 2015

Authors and Affiliations

  1. 1.Institute of Discrete Mathematics and GeometryVienna University of TechnologyViennaAustria
  2. 2.Institute of Information SystemsVienna University of TechnologyViennaAustria

Personalised recommendations