Abstract
One of the most fundamental methods for comparing two given strings A and B is the longest common subsequence (LCS), where the task is to find (the length) of the longest common subsequence. In this paper, we address the STR-IC-LCS problem which is one of the constrained LCS problems proposed by Chen and Chao [J. Comb. Optim, 2011]. A string Z is said to be an STR-IC-LCS of three given strings A, B, and P, if Z is one of the longest common subsequences of A and B that contains P as a substring. We present a space efficient solution for the STR-IC-LCS problem. Our algorithm computes the length of an STR-IC-LCS in \(O(n^2)\) time and \(O((\ell +1)(n-\ell +1))\) space where \(\ell \) is the length of a longest common subsequence of A and B of length n. When \(\ell = O(1)\) or \(n-\ell = O(1)\), then our algorithm uses only linear O(n) space.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Abboud, A., Backurs, A., Williams, V.V.: Tight hardness results for LCS and other sequence similarity measures. In: FOCS 2015, pp. 59–78 (2015)
Bille, P., Farach-Colton, M.: Fast and compact regular expression matching. Theor. Comput. Sci. 409(3), 486–496 (2008)
Chen, Y.C., Chao, K.M.: On the generalized constrained longest common subsequence problems. J. Comb. Optim. 21(3), 383–392 (2011). https://doi.org/10.1007/s10878-009-9262-5
Chin, F.Y., Santis, A.D., Ferrara, A.L., Ho, N., Kim, S.: A simple algorithm for the constrained sequence problems. Inf. Process. Lett. 90(4), 175–179 (2004). https://doi.org/10.1016/j.ipl.2004.02.008, http://www.sciencedirect.com/science/article/pii/S0020019004000614
Deorowicz, S.: Quadratic-time algorithm for a string constrained LCS problem. Inf. Process. Lett. 112(11), 423–426 (2012). https://doi.org/10.1016/j.ipl.2012.02.007, http://www.sciencedirect.com/science/article/pii/S0020019012000567
Hirschberg, D.S.: A linear space algorithm for computing maximal common subsequences. Commun. ACM 18(6), 341–343 (1975)
Kuboi, K., Fujishige, Y., Inenaga, S., Bannai, H., Takeda, M.: Faster STR-IC-LCS computation via RLE. In: Kärkkäinen, J., Radoszewski, J., Rytter, W. (eds.) 28th Annual Symposium on Combinatorial Pattern Matching, CPM 2017, July 4–6, 2017, Warsaw, Poland. LIPIcs, vol. 78, pp. 20:1–20:12. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2017). https://doi.org/10.4230/LIPIcs.CPM.2017.20
Liu, J.J., Wang, Y.L., Chiu, Y.S.: Constrained Longest Common Subsequences with Run-Length-Encoded Strings. Comput. J. 58(5), 1074–1084 (2014). https://doi.org/10.1093/comjnl/bxu012
Masek, W.J., Paterson, M.: A faster algorithm computing string edit distances. J. Comput. Syst. Sci. 20(1), 18–31 (1980)
Nakatsu, N., Kambayashi, Y., Yajima, S.: A longest common subsequence algorithm suitable for similar text strings. Acta Inf. 18, 171–179 (1982). https://doi.org/10.1007/BF00264437
Tsai, Y.T.: The constrained longest common subsequence problem. Inf. Process. Lett. 88(4), 173–176 (2003). https://doi.org/10.1016/j.ipl.2003.07.001, http://www.sciencedirect.com/science/article/pii/S002001900300406X
Wagner, R.A., Fischer, M.J.: The string-to-string correction problem. J. ACM 21(1), 168–173 (1974). https://doi.org/10.1145/321796.321811, http://doi.acm.org/10.1145/321796.321811
Yamada, K., Nakashima, Y., Inenaga, S., Bannai, H., Takeda, M.: Faster STR-EC-LCS computation. In: Chatzigeorgiou, A., et al. (eds.) SOFSEM 2020. LNCS, vol. 12011, pp. 125–135. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-38919-2_11
Acknowledgments
This work was supported by JSPS KAKENHI Grant Numbers JP21K17705 (YN), JP22H03551 (SI), JP20H04141 (HB), and by JST PRESTO Grant Number JPMJPR1922 (SI).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Yonemoto, Y., Nakashima, Y., Inenaga, S., Bannai, H. (2023). Space-Efficient STR-IC-LCS Computation. In: GÄ…sieniec, L. (eds) SOFSEM 2023: Theory and Practice of Computer Science. SOFSEM 2023. Lecture Notes in Computer Science, vol 13878. Springer, Cham. https://doi.org/10.1007/978-3-031-23101-8_25
Download citation
DOI: https://doi.org/10.1007/978-3-031-23101-8_25
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-23100-1
Online ISBN: 978-3-031-23101-8
eBook Packages: Computer ScienceComputer Science (R0)