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)\).
Similar content being viewed by others
Notes
The reason why we do not set \(b_{\mathsf {run}(P)}=\lfloor \mathsf {run}(F(\mathsf {run}(P))/2\rfloor \) is a rather technical one: \(F(\mathsf {run}(P))\) may end with a run up if the last run in P is a run up and may end with a run down if the last run in P is a run down. This would lead to unwanted collisions concerning the Index function and consequently would prohibit the proof of Lemma 5.
References
Ahal, S., Rabinovich, Y.: On complexity of the subpattern problem. SIAM J. Discrete Math. 22(2), 629–649 (2008)
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)
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)
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)
Bóna, M.: Combinatorics of Permutations. Discrete Mathematics and Its Applications. Chapman & Hall/CRC, Boca Raton (2004)
Bose, P., Buss, J.F., Lubiw, A.: Pattern matching for permutations. Inf. Process. Lett. 65(5), 277–283 (1998)
Bouvel, M., Rossin, D.: The longest common pattern problem for two permutations. Pure Math. Appl. 17(1–2), 55–69 (2006)
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)
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)
Bruner, M.L., Lackner, M.: The computational landscape of permutation patterns. Pure Math. Appl. 24(2), 83–101 (2013)
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)
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)
David, F.N., Barton, D.E.: Combinatorial Chance. Griffin, London (1962)
Downey, R., Fellows, M.: Fundamentals of Parameterized Complexity. Texts in Computer Science. Springer, Berlin (2013)
Downey, R.G., Fellows, M.R.: Parameterized Complexity. Springer, Berlin (1999)
Flajolet, P., Sedgewick, R.: Analytic Combinatorics. Cambridge University Press, Cambridge (2009)
Flum, J., Grohe, M.: Parameterized Complexity Theory. Springer, Berlin (2006)
Fomin, F., Kratsch, D.: Exact Exponential Algorithms. Texts in Theoretical Computer Science. An EATCS Series. Springer, Berlin (2010)
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)
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)
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)
Guo, J., Niedermeier, R.: Invitation to data reduction and problem kernelization. SIGACT News 38(1), 31–45 (2007)
Ibarra, L.: Finding pattern matchings for permutations. Inf. Process. Lett. 61(6), 293–295 (1997)
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)
Kitaev, S.: Patterns in Permutations and Words. Springer, Berlin (2011)
Klenke, A.: Probability Theory: A Comprehensive Course. Springer, Berlin (2008)
Knuth, D.E.: The Art of Computer Programming: Fundamental Algorithms, vol. I. Addison-Wesley, Reading (1968)
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)
Levene, H., Wolfowitz, J.: The covariance matrix of runs up and down. Ann. Math. Stat. 15(1), 58–69 (1944)
Mäkinen, E.: On the longest upsequence problem for permutations. Int. J. Comput. Math. 77(1), 45–53 (2001)
Niedermeier, R.: Invitation to Fixed-Parameter Algorithms, Lecture Series in Mathematics and Its Applications. Oxford University Press, Oxford (2006)
Saxena, S., Yugandhar, V.: Parallel algorithms for separable permutations. Discrete Appl. Math. 146(3), 343–364 (2005)
Schensted, C.: Longest increasing and decreasing subsequences. Canad. J. Math. 13,179–191(1961)
Simion, R., Schmidt, F.W.: Restricted permutations. Eur. J. Comb. 6, 383–406 (1985)
Van Emde Boas, P.: Machine models and simulations. In: Van Leeuwen, J. (ed.) Handbook of Theoretical Computer Science, vol. A. Elsevier, Amsterdam (1990)
Vatter, V.: Permutation patterns. In: Bóna, M. (ed.) Handbook of Enumerative Combinatorics. CRC Press, Boca Raton (2015)
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.
Author information
Authors and Affiliations
Corresponding author
Additional information
A preliminary version of this paper [9] appeared in the proceedings of the 13th Scandinavian Symposium and Workshops on Algorithm Theory, SWAT 2012.
Rights and permissions
About this article
Cite this article
Bruner, ML., Lackner, M. A Fast Algorithm for Permutation Pattern Matching Based on Alternating Runs. Algorithmica 75, 84–117 (2016). https://doi.org/10.1007/s00453-015-0013-y
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00453-015-0013-y