Polynomial-Delay Enumeration of Maximal Common Subsequences

  • Alessio Conte
  • Roberto Grossi
  • Giulia PunziEmail author
  • Takeaki Uno
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11811)


A Maximal Common Subsequence (MCS) between two strings X and Y is an inclusion-maximal subsequence of both X and Y. MCSs are a natural generalization of the classical concept of Longest Common Subsequence (LCS), which can be seen as a longest MCS. We study the problem of efficiently listing all the distinct MCSs between two strings. As discussed in the paper, this problem is algorithmically challenging as the same MCS cannot be listed multiple times: for example, dynamic programming [Fraser et al., CPM 1998] incurs in an exponential waste of time, and a recent algorithm for finding an MCS [Sakai, CPM 2018] does not seem to immediately extend to listing. We follow an alternative and novel graph-based approach, proposing the first output-sensitive algorithm for this problem: it takes polynomial time in n per MCS found, where \(n = \max \{ |X|, |Y|\}\), with polynomial preprocessing time and space.


  1. 1.
    Abboud, A., Backurs, A., Williams, V.V.: Tight hardness results for LCS and other sequence similarity measures. In: 2015 IEEE 56th Annual Symposium on Foundations of Computer Science, pp. 59–78. October 2015Google Scholar
  2. 2.
    Apostolico, A.: Improving the worst-case performance of the Hunt-Szymanski strategy for the longest common subsequence of two strings. Inf. Process. Lett. 23(2), 63–69 (1986)MathSciNetCrossRefGoogle Scholar
  3. 3.
    Bergroth, L., Hakonen, H., Raita, T.: A survey of longest common subsequence algorithms. In: Proceedings Seventh International Symposium on String Processing and Information Retrieval. SPIRE 2000, pp. 39–48. September 2000Google Scholar
  4. 4.
    Eppstein, D., Galil, Z., Giancarlo, R., Italiano, G.F.: Sparse dynamic programming I: linear cost functions. J. ACM 39(3), 519–545 (1992)MathSciNetCrossRefGoogle Scholar
  5. 5.
    Fraser, C.B., Irving, R.W., Middendorf, M.: Maximal common subsequences and minimal common supersequences. Inf. Comput. 124(2), 145–153 (1996)MathSciNetCrossRefGoogle Scholar
  6. 6.
    Hirschberg, D.S.: Algorithms for the longest common subsequence problem. J. ACM 24(4), 664–675 (1977)MathSciNetCrossRefGoogle Scholar
  7. 7.
    Hunt, J.W., Szymanski, T.G.: A fast algorithm for computing longest common subsequences. Commun. ACM 20(5), 350–353 (1977)MathSciNetCrossRefGoogle Scholar
  8. 8.
    Kanté, M.M., Limouzy, V., Mary, A., Nourine, L.: On the enumeration of minimal dominating sets and related notions. SIAM J. Discrete Math. 28(4), 1916–1929 (2014)MathSciNetCrossRefGoogle Scholar
  9. 9.
    Lawler, E.L., Lenstra, J.K., Rinnooy Kan, A.H.G.: Generating all maximal independent sets: NP-hardness and polynomial-time algorithms. SIAM Journal on Computing 9(3), 558–565 (1980)MathSciNetCrossRefGoogle Scholar
  10. 10.
    Masek, W.J., Paterson, M.S.: A faster algorithm computing string edit distances. J. Comput. Syst. Sci. 20(1), 18–31 (1980)MathSciNetCrossRefGoogle Scholar
  11. 11.
    Sakai, Y.: Maximal common subsequence algorithms. In: Navarro, G., Sankoff, D., Zhu, B. (eds.) Annual Symposium on Combinatorial Pattern Matching (CPM 2018), vol. 105, Leibniz International Proceedings in Informatics (LIPIcs), pp. 1:1–1:10. Dagstuhl, Germany, Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (2018)Google Scholar
  12. 12.
    Wagner, R.A., Fischer, M.J.: The string-to-string correction problem. J. ACM 21(1), 168–173 (1974)MathSciNetCrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  • Alessio Conte
    • 1
  • Roberto Grossi
    • 1
  • Giulia Punzi
    • 1
    Email author
  • Takeaki Uno
    • 2
  1. 1.Università di PisaPisaItaly
  2. 2.National Institute of InformaticsTokyoJapan

Personalised recommendations