Skip to main content

Shortest Unique Palindromic Substring Queries in Semi-dynamic Settings

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

Abstract

A palindromic substring T[i..j] of a string T is said to be a shortest unique palindromic substring (SUPS) in T for an interval [pq] if T[i..j] is a shortest one such that T[i..j] occurs only once in T, and [ij] contains [pq]. The SUPS problem is, given a string T of length n, to construct a data structure that can compute all the SUPSs for any given query interval. It is known that any SUPS query can be answered in \(O(\alpha )\) time after O(n)-time preprocessing, where \(\alpha \) is the number of SUPSs to output [Inoue et al., 2018]. In this paper, we first show that \(\alpha \) is at most 4, and the upper bound is tight. Also, we present an algorithm to solve the SUPS problem for a sliding window that can answer any query in \(O(\log \log W)\) time and update data structures in amortized \(O(\log \sigma )\) time, where W is the size of the window, and \(\sigma \) is the alphabet size. Furthermore, we consider the SUPS problem in the after-edit model and present an efficient algorithm. Namely, we present an algorithm that uses O(n) time for preprocessing and answers any k SUPS queries in \(O(\log n\log \log n + k\log \log n)\) time after single character substitution. As a by-product, we propose a fully-dynamic data structure for range minimum queries (RmQs) with a constraint where the width of each query range is limited to polylogarithmic. The constrained RmQ data structure can answer such a query in constant time and support a single-element edit operation in amortized constant time.

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 79.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 99.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.

    A preliminary version of [19] appeared in IWOCA 2017 [26].

  2. 2.

    Since MUPSs cannot be nested [19], they are also sorted by their ending positions.

References

  1. Abedin, P., Hooshmand, S., Ganguly, A., Thankachan, S.V.: The heaviest induced ancestors problem: better data structures and applications. Algorithmica (2022). https://doi.org/10.1007/s00453-022-00955-7

  2. Alstrup, S., Husfeldt, T., Rauhe, T.: Marked ancestor problems. In: 39th Annual Symposium on Foundations of Computer Science, FOCS 1998, 8–11 November 1998, Palo Alto, California, USA, pp. 534–544. IEEE Computer Society (1998). https://doi.org/10.1109/SFCS.1998.743504

  3. Amir, A., Boneh, I.: Dynamic palindrome detection. CoRR abs/1906.09732 (2019). http://arxiv.org/abs/1906.09732

  4. Amir, A., Boneh, I., Charalampopoulos, P., Kondratovsky, E.: Repetition detection in a dynamic string. In: Bender, M.A., Svensson, O., Herman, G. (eds.) 27th Annual European Symposium on Algorithms, ESA 2019, 9–11 September 2019, Munich/Garching, Germany. LIPIcs, vol. 144, pp. 5:1–5:18. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2019). https://doi.org/10.4230/LIPIcs.ESA.2019.5

  5. Amir, A., Charalampopoulos, P., Iliopoulos, C.S., Pissis, S.P., Radoszewski, J.: Longest common factor after one edit operation. In: Fici, G., Sciortino, M., Venturini, R. (eds.) SPIRE 2017. LNCS, vol. 10508, pp. 14–26. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-67428-5_2

    Chapter  Google Scholar 

  6. Amir, A., Charalampopoulos, P., Pissis, S.P., Radoszewski, J.: Dynamic and internal longest common substring. Algorithmica 82(12), 3707–3743 (2020). https://doi.org/10.1007/s00453-020-00744-0

    Article  MathSciNet  MATH  Google Scholar 

  7. Brodal, G.S., Davoodi, P., Srinivasa Rao, S.: Path minima queries in dynamic weighted trees. In: Dehne, F., Iacono, J., Sack, J.-R. (eds.) WADS 2011. LNCS, vol. 6844, pp. 290–301. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-22300-6_25

    Chapter  Google Scholar 

  8. Charalampopoulos, P., Gawrychowski, P., Pokorski, K.: Dynamic longest common substring in polylogarithmic time. In: Czumaj, A., Dawar, A., Merelli, E. (eds.) 47th International Colloquium on Automata, Languages, and Programming, ICALP 2020, 8–11 July 2020, Saarbrücken, Germany (Virtual Conference). LIPIcs, vol. 168, pp. 27:1–27:19. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2020). https://doi.org/10.4230/LIPIcs.ICALP.2020.27

  9. Cleary, J.G., Witten, I.H.: Data compression using adaptive coding and partial string matching. IEEE Trans. Commun. 32(4), 396–402 (1984). https://doi.org/10.1109/TCOM.1984.1096090

    Article  Google Scholar 

  10. Crochemore, M., Héliou, A., Kucherov, G., Mouchard, L., Pissis, S.P., Ramusat, Y.: Absent words in a sliding window with applications. Inf. Comput. 270 (2020). https://doi.org/10.1016/j.ic.2019.104461

  11. van Emde Boas, P.: Preserving order in a forest in less than logarithmic time and linear space. Inf. Process. Lett. 6(3), 80–82 (1977). https://doi.org/10.1016/0020-0190(77)90031-X

    Article  MATH  Google Scholar 

  12. Fiala, E.R., Greene, D.H.: Data compression with finite windows. Commun. ACM 32(4), 490–505 (1989). https://doi.org/10.1145/63334.63341

    Article  Google Scholar 

  13. Fine, N.J., Wilf, H.S.: Uniqueness theorems for periodic functions. Proc. Am. Math. Soc. 16(1), 109–114 (1965). https://doi.org/10.1090/S0002-9939-1965-0174934-9

    Article  MathSciNet  MATH  Google Scholar 

  14. Funakoshi, M., Mieno, T.: Minimal unique palindromic substrings after single-character substitution. In: Lecroq, T., Touzet, H. (eds.) SPIRE 2021. LNCS, vol. 12944, pp. 33–46. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-86692-1_4

    Chapter  Google Scholar 

  15. Funakoshi, M., Nakashima, Y., Inenaga, S., Bannai, H., Takeda, M.: Computing longest palindromic substring after single-character or block-wise edits. Theor. Comput. Sci. 859, 116–133 (2021). https://doi.org/10.1016/j.tcs.2021.01.014

    Article  MathSciNet  MATH  Google Scholar 

  16. Gawrychowski, P., Karczmarz, A., Kociumaka, T., Lacki, J., Sankowski, P.: Optimal dynamic strings. In: Czumaj, A. (ed.) Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2018, New Orleans, LA, USA, 7–10 January 2018, pp. 1509–1528. SIAM (2018). https://doi.org/10.1137/1.9781611975031.99

  17. Gawrychowski, P., Merkurev, O., Shur, A.M., Uznański, P.: Tight tradeoffs for real-time approximation of longest palindromes in streams. Algorithmica 81(9), 3630–3654 (2019). https://doi.org/10.1007/s00453-019-00591-8

    Article  MathSciNet  MATH  Google Scholar 

  18. Gusfield, D.: Algorithms on Strings, Trees, and Sequences - Computer Science and Computational Biology. Cambridge University Press (1997). https://doi.org/10.1017/cbo9780511574931

  19. Inoue, H., Nakashima, Y., Mieno, T., Inenaga, S., Bannai, H., Takeda, M.: Algorithms and combinatorial properties on shortest unique palindromic substrings. J. Discrete Algorithms 52–53, 122–132 (2018). https://doi.org/10.1016/j.jda.2018.11.009

    Article  MathSciNet  MATH  Google Scholar 

  20. Kempa, D., Kociumaka, T.: Dynamic suffix array with polylogarithmic queries and updates. CoRR abs/2201.01285 (2021). https://arxiv.org/abs/2201.01285

  21. Kuramoto, E., et al.: Oligonucleotide sequences required for natural killer cell activation. Jpn. J. Cancer Res. 83(11), 1128–1131 (1992). https://doi.org/10.1111/j.1349-7006.1992.tb02734.x

  22. Larsson, N.J.: Extended application of suffix trees to data compression. In: Storer, J.A., Cohn, M. (eds.) Proceedings of the 6th Data Compression Conference (DCC 1996), Snowbird, Utah, USA, 31 March–3 April 1996, pp. 190–199. IEEE Computer Society (1996). https://doi.org/10.1109/DCC.1996.488324

  23. 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). https://doi.org/10.1145/321892.321896

    Article  MATH  Google Scholar 

  24. Mieno, T., Fujishige, Y., Nakashima, Y., Inenaga, S., Bannai, H., Takeda, M.: Computing minimal unique substrings for a sliding window. Algorithmica (9), 1–24 (2021). https://doi.org/10.1007/s00453-021-00864-1

  25. Mieno, T., Watanabe, K., Nakashima, Y., Inenaga, S., Bannai, H., Takeda, M.: Palindromic trees for a sliding window and its applications. Inf. Process. Lett. 173, 106174 (2022). https://doi.org/10.1016/j.ipl.2021.106174

  26. Nakashima, Y., Inoue, H., Mieno, T., Inenaga, S., Bannai, H., Takeda, M.: Shortest unique palindromic substring queries in optimal time. In: Brankovic, L., Ryan, J., Smyth, W.F. (eds.) IWOCA 2017. LNCS, vol. 10765, pp. 397–408. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-78825-8_32

  27. Senft, M.: Suffix tree for a sliding window: an overview. In: WDS 2005, pp. 41–46 (2005)

    Google Scholar 

  28. Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14(3), 249–260 (1995). https://doi.org/10.1007/BF01206331

  29. Urabe, Y., Nakashima, Y., Inenaga, S., Bannai, H., Takeda, M.: Longest Lyndon substring after edit. In: Navarro, G., Sankoff, D., Zhu, B. (eds.) Annual Symposium on Combinatorial Pattern Matching, CPM 2018, 2–4 July 2018, Qingdao, China. LIPIcs, vol. 105, pp. 19:1–19:10. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2018). https://doi.org/10.4230/LIPIcs.CPM.2018.19

  30. Watanabe, K., Nakashima, Y., Inenaga, S., Bannai, H., Takeda, M.: Fast algorithms for the shortest unique palindromic substring problem on run-length encoded strings. Theory Comput. Syst. 64(7), 1273–1291 (2020). https://doi.org/10.1007/s00224-020-09980-x

  31. Yamamoto, S., Yamamoto, T., Kataoka, T., Kuramoto, E., Yano, O., Tokunaga, T.: Unique palindromic sequences in synthetic oligonucleotides are required to induce IFN [correction of INF] and augment IFN-mediated [correction of INF] natural killer activity. J. Immunol. 148(12), 4072–4076 (1992). https://www.jimmunol.org/content/148/12/4072

  32. Ziv, J., Lempel, A.: A universal algorithm for sequential data compression. IEEE Trans. Inf. Theory 23(3), 337–343 (1977). https://doi.org/10.1109/TIT.1977.1055714

Download references

Acknowledgements

We would like to thank Professor Jeffrey Shallit (University of Waterloo), a PC member of IWOCA 2022, for his interest in our paper and his advice to simplify our proofs. We would also like to thank the anonymous referees for their helpful comments on the manuscript. This work was supported by the JSPS KAKENHI Grant Numbers JP20J11983 (TM) and JP20J21147 (MF).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Takuya Mieno .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Mieno, T., Funakoshi, M. (2022). Shortest Unique Palindromic Substring Queries in Semi-dynamic Settings. In: Bazgan, C., Fernau, H. (eds) Combinatorial Algorithms. IWOCA 2022. Lecture Notes in Computer Science, vol 13270. Springer, Cham. https://doi.org/10.1007/978-3-031-06678-8_31

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-06678-8_31

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-06677-1

  • Online ISBN: 978-3-031-06678-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics