Summary
The LCS problem is to determine the longest common subsequence (LCS) of two strings. A new linear-space algorithm to solve the LCS problem is presented. The only other algorithm with linear-space complexity is by Hirschberg and has runtime complexity O(mn). Our algorithm, based on the divide and conquer technique, has runtime complexity O(n(m-p)), where p is the length of the LCS.
Similar content being viewed by others
References
Aho, A.V., Hirschberg, D.S., Ullmann, J.D.: Bounds on the complexity of the longest common subsequence problem. JACM 23, 1–12 (1976)
Dayhoff, M.O.: Computer analysis of protein evolution. Scientific American 221, 86–95 (1969)
Hirschberg, D.S.: A linear space algorithm for computing maximal common subsequences. Commun. ACM 18, 341–343 (1975)
Hirschberg, D.S.: Algorithms for the longest common subsequence problem. JACM 2b4, 664–675 (1977)
Hsu, W.J., Du, M.W.: New algorithms for the LCS problem. J. Comput. Syst. Sci. 29, 133–152 (1984)
Hunt, J.W., Szymanski, T.G.: A fast algorithm for computing longest common subsequences. Commun. ACM 2b0, 350–353 (1977)
Lu, S.Y., Fu, K.S.: A sentence-to-sentence clustering procedure for pattern analysis. IEEE Trans. Syst. Man. Cybernet. SMC-8, 381–389 (1978)
Maier, D.: The complexity of some problems on subsequences and supersequences. JACM 25, 322–336 (1978)
Masek, W.J., Paterson, M.S.: A faster algorithm for computing string edit distances. J. Comput. Syst. Sci. 20, 18–31 (1980)
Mukhopadhyay, A.: A fast algorithm for the longest-common-subsequence problem. Inf. Sci. 20, 69–82 (1980)
Nakatsu, N., Kambayashi, Y., Yajima, S.: A longest common subsequence algorithm suitable for similar text strings. Acta Inf. 18, 171–179 (1982)
Wagner, R.A., Fischer, M.J.: The string-to-string correction problem. JACM 21, 168–173 (1974)
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Kumar, S.K., Rangan, C.P. A linear space algorithm for the LCS problem. Acta Informatica 24, 353–362 (1987). https://doi.org/10.1007/BF00265993
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00265993