Skip to main content

Finding Gapped Palindromes Online

  • Conference paper
  • First Online:
Combinatorial Algorithms (IWOCA 2016)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9843))

Included in the following conference series:

Abstract

A string s is said to be a gapped palindrome iff \(s = xyx^R\) for some strings xy 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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 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. 2.

    Originally, Kolpakov and Kucherov [8] stated their algorithm works in \(O(n + S)\) time, where S is the number of outputs. It follows from a recent work by Gawrychowski et al. [5] that \(S = O(n)\).

  3. 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. 4.

    Since the gap length varies in range \([ g _{\min }, g _{\max }]\), we here consider both outward and inward maximality of the arms.

References

  1. Apostolico, A., Breslauer, D., Galil, Z.: Parallel detection of all palindromes in a string. Theor. Comput. Sci. 141(1&2), 163–173 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  2. 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)

    Chapter  Google Scholar 

  3. Cole, R., Hariharan, R.: Dynamic LCA queries on trees. SIAM J. Comput. 34(4), 894–923 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  4. Farach-Colton, M., Ferragina, P., Muthukrishnan., S.: On the sorting-complexity of suffix tree construction. J. ACM 47(6), 987–1011 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  5. 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

  6. Gusfield, D.: Algorithms on Strings, Trees, and Sequences. Cambridge University Press, New York (1997)

    Book  MATH  Google Scholar 

  7. Inenaga, S.: Bidirectional construction of suffix trees. Nord. J. Comput. 10(1), 52 (2003)

    MathSciNet  MATH  Google Scholar 

  8. Kolpakov, R., Kucherov, G.: Searching for gapped palindromes. Theor. Comput. Sci. 410(51), 5365–5373 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  9. Kosolobov, D., Rubinchik, M., Shur, A.M.: Finding distinct subpalindromes online. In: PSC 2013, pp. 63–69 (2013)

    Google Scholar 

  10. 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)

    Article  MATH  Google Scholar 

  11. Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14(3), 249–260 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  12. Weiner, P.: Linear pattern matching algorithms. In: 14th Annual Symposium on Switching and Automata Theory, pp. 1–11 (1973)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Yuta Fujishige .

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics