Abstract
A string s is said to be a gapped palindrome iff \(s = xyx^R\) for some strings x, y such that \(|x| \ge 1\), \(|y| \ge 2\), and \(x^R\) denotes the reverse image of x. In this paper we consider two kinds of gapped palindromes, and present efficient online algorithms to compute these gapped palindromes occurring in a string. First, we show an online algorithm to find all maximal g-gapped palindromes with fixed gap length \(g \ge 2\) in a string of length n in \(O(n \log \sigma )\) time and O(n) space, where \(\sigma \) is the alphabet size. Second, we show an online algorithm to find all maximal length-constrained gapped palindromes with arm length at least \( A \ge 1\) and gap length in range \([ g _{\min }, g _{\max }]\) in \(O(n(\frac{ g _{\max }- g _{\min }}{ A } + \log \sigma ))\) time and O(n) space. We also show that if \( A \) is a constant, then there exists a string of length n which contains \(\varOmega (n( g _{\max }- g _{\min }))\) maximal LCGPs, which implies we cannot hope for a significant speed-up in the worst case.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
If y is a single character, then \(xyx^R\) is a palindrome of odd length. Thus we here assume y is of length at least 2.
- 2.
- 3.
Since the gap length is fixed to g and since it simplifies the description of the algorithm, here we do not consider inward maximality of the arms. However, it is easy to modify our algorithm so that it outputs all g-gapped palindromes that are both outward and inward maximal with the same efficiency.
- 4.
Since the gap length varies in range \([ g _{\min }, g _{\max }]\), we here consider both outward and inward maximality of the arms.
References
Apostolico, A., Breslauer, D., Galil, Z.: Parallel detection of all palindromes in a string. Theor. Comput. Sci. 141(1&2), 163–173 (1995)
Bender, M.A., Farach-Colton, M.: The LCA problem revisited. In: Gonnet, G.H., Viola, A. (eds.) LATIN 2000. LNCS, vol. 1776, pp. 88–94. Springer, Heidelberg (2000)
Cole, R., Hariharan, R.: Dynamic LCA queries on trees. SIAM J. Comput. 34(4), 894–923 (2005)
Farach-Colton, M., Ferragina, P., Muthukrishnan., S.: On the sorting-complexity of suffix tree construction. J. ACM 47(6), 987–1011 (2000)
Gawrychowski, P., Tomohiro, I., Inenaga, S., Köppl, D., Manea, F.: Efficiently finding all maximal \(\alpha \)-gapped repeats. In: STACS 2016 (to appear, 2016). http://arxiv.org/abs/1509.09237
Gusfield, D.: Algorithms on Strings, Trees, and Sequences. Cambridge University Press, New York (1997)
Inenaga, S.: Bidirectional construction of suffix trees. Nord. J. Comput. 10(1), 52 (2003)
Kolpakov, R., Kucherov, G.: Searching for gapped palindromes. Theor. Comput. Sci. 410(51), 5365–5373 (2009)
Kosolobov, D., Rubinchik, M., Shur, A.M.: Finding distinct subpalindromes online. In: PSC 2013, pp. 63–69 (2013)
Manacher, G.K.: A new linear-time on-line algorithm for finding the smallest initial palindrome of a string. J. ACM 22(3), 346–351 (1975)
Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14(3), 249–260 (1995)
Weiner, P.: Linear pattern matching algorithms. In: 14th Annual Symposium on Switching and Automata Theory, pp. 1–11 (1973)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this paper
Cite this paper
Fujishige, Y., Nakamura, M., Inenaga, S., Bannai, H., Takeda, M. (2016). Finding Gapped Palindromes Online. In: Mäkinen, V., Puglisi, S., Salmela, L. (eds) Combinatorial Algorithms. IWOCA 2016. Lecture Notes in Computer Science(), vol 9843. Springer, Cham. https://doi.org/10.1007/978-3-319-44543-4_15
Download citation
DOI: https://doi.org/10.1007/978-3-319-44543-4_15
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-44542-7
Online ISBN: 978-3-319-44543-4
eBook Packages: Computer ScienceComputer Science (R0)