Skip to main content

Computing String Covers in Sublinear Time

  • Conference paper
  • First Online:
String Processing and Information Retrieval (SPIRE 2024)

Abstract

In the word RAM model, a string T of length n over an integer alphabet of size \(\sigma \) can be represented in \(\mathcal {O}(n /\log _\sigma n)\) space. We show that a representation of all covers of T can be computed in the optimal \(\mathcal {O}(n/\log _\sigma n)\) time; in particular, the shortest cover can be computed within this time. We also design an \(\mathcal {O}(n(\log \sigma + \log \log n)/\log n)\)-sized data structure that computes in \(\mathcal {O}(1)\) time any element of the so-called (shortest) cover array of T, that is, the length of the shortest cover of any given prefix of T. As a by-product, we describe the structure of the cover array of Fibonacci strings. On the negative side, we show that the shortest cover of a length-n string cannot be computed using \(o(n/\log n)\) operations in the PILLAR model of Charalampopoulos, Kociumaka, and Wellnitz (FOCS 2020).

J. Radoszewski—Supported by the Polish National Science Center, grant no. 2022/46/E/ST6/00463

W. Zuba—Supported by the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie Grant Agreement No. 101034253.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Apostolico, A., Farach, M., Iliopoulos, C.S.: Optimal superprimitivity testing for strings. Inf. Process. Lett. 39(1), 17–20 (1991). https://doi.org/10.1016/0020-0190(91)90056-N

    Article  MathSciNet  Google Scholar 

  2. Bannai, H., Ellert, J.: Lyndon arrays in sublinear time. In: Gørtz, I.L., Farach-Colton, M., Puglisi, S.J., Herman, G. (eds.) 31st Annual European Symposium on Algorithms, ESA 2023, 4–6 September 2023, Amsterdam. LIPIcs, vol. 274, pp. 14:1–14:16. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2023). https://doi.org/10.4230/LIPICS.ESA.2023.14

  3. Bannai, H., Mieno, T., Nakashima, Y.: Lyndon words, the three squares lemma, and primitive squares. In: Boucher, C., Thankachan, S.V. (eds.) SPIRE 2020. LNCS, vol. 12303, pp. 265–273. Springer, Heidelberg (2020). https://doi.org/10.1007/978-3-030-59212-7_19

  4. Belazzougui, D., Kosolobov, D., Puglisi, S.J., Raman, R.: Weighted ancestors in suffix trees revisited. In: Gawrychowski, P., Starikovskaya, T. (eds.) 32nd Annual Symposium on Combinatorial Pattern Matching, CPM 2021, 5–7 July 2021, Wrocław. LIPIcs, vol. 191, pp. 8:1–8:15. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2021). https://doi.org/10.4230/LIPICS.CPM.2021.8

  5. Ben-Kiki, O., Bille, P., Breslauer, D., Gasieniec, L., Grossi, R., Weimann, O.: Towards optimal packed string matching. Theor. Comput. Sci. 525, 111–129 (2014). https://doi.org/10.1016/J.TCS.2013.06.013

  6. Bender, M.A., Farach-Colton, M.: The LCA problem revisited. In: Gonnet, G.H., Panario, D., Viola, A. (eds.) LATIN 2000. LNCS, vol. 1776, pp. 88–94. Springer, Heidelberg (2000). https://doi.org/10.1007/10719839_9

  7. Breslauer, D.: An on-line string superprimitivity test. Inf. Process. Lett. 44(6), 345–347 (1992). https://doi.org/10.1016/0020-0190(92)90111-8

    Article  MathSciNet  Google Scholar 

  8. Breslauer, D., Galil, Z.: Finding all periods and initial palindromes of a string in parallel. Algorithmica 14(4), 355–366 (1995). https://doi.org/10.1007/BF01294132

    Article  MathSciNet  Google Scholar 

  9. de Bruijn, N.G.: A combinatorial problem. Indagationes Math. 8, 461–467 (1946). http://www.dwc.knaw.nl/DL/publications/PU00018235.pdf

  10. Charalampopoulos, P., Kociumaka, T., Pissis, S.P., Radoszewski, J.: Faster algorithms for longest common substring. In: Mutzel, P., Pagh, R., Herman, G. (eds.) 29th Annual European Symposium on Algorithms, ESA 2021, 6–8 September 2021, Lisbon (Virtual Conference). LIPIcs, vol. 204, pp. 30:1–30:17. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2021). https://doi.org/10.4230/LIPICS.ESA.2021.30

  11. Charalampopoulos, P., Kociumaka, T., Wellnitz, P.: Faster approximate pattern matching: a unified approach. In: Irani, S. (ed.) 61st IEEE Annual Symposium on Foundations of Computer Science, FOCS 2020, Durham, 16–19 November 2020, pp. 978–989. IEEE (2020). https://doi.org/10.1109/FOCS46700.2020.00095

  12. Charalampopoulos, P., Kociumaka, T., Wellnitz, P.: Faster approximate pattern matching: a unified approach. In: 61st IEEE Annual Symposium on Foundations of Computer Science, FOCS 2020, pp. 978–989. IEEE (2020). https://doi.org/10.1109/FOCS46700.2020.00095. Full version: arXiv:2004.08350v2

  13. Charalampopoulos, P., Pissis, S.P., Radoszewski, J.: Longest palindromic substring in sublinear time. In: Bannai, H., Holub, J. (eds.) 33rd Annual Symposium on Combinatorial Pattern Matching, CPM 2022, 27–29 June 2022, Prague. LIPIcs, vol. 223, pp. 20:1–20:9. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2022). https://doi.org/10.4230/LIPICS.CPM.2022.20

  14. Christou, M., Crochemore, M., Iliopoulos, C.S.: Quasiperiodicities in Fibonacci strings. Ars Comb. 129, 211–225 (2016). https://arxiv.org/abs/1201.6162

  15. Crochemore, M., et al.: The maximum number of squares in a tree. In: Kärkkäinen, J., Stoye, J. (eds.) CPM 2012. LNCS, vol. 7354, pp. 27–40. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-31265-6_3

  16. Crochemore, M., Iliopoulos, C.S., Pissis, S.P., Tischler, G.: Cover array string reconstruction. In: Amir, A., Parida, L. (eds.) CPM 2010. LNCS, vol. 6129, pp. 251–259. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-13509-5_23

  17. Crochemore, M., et al.: Internal quasiperiod queries. In: Boucher, C., Thankachan, S.V. (eds.) SPIRE 2020. LNCS, vol. 12303, pp. 60–75. Springer, Heidelberg (2020). https://doi.org/10.1007/978-3-030-59212-7_5

  18. Crochemore, M., et al.: Shortest covers of all cyclic shifts of a string. Theor. Comput. Sci. 866, 70–81 (2021). https://doi.org/10.1016/J.TCS.2021.03.011

  19. Crochemore, M., Rytter, W.: Squares, cubes, and time-space efficient string searching. Algorithmica 13(5), 405–425 (1995). https://doi.org/10.1007/BF01190846

    Article  MathSciNet  Google Scholar 

  20. Duyster, A., Kociumaka, T.: Logarithmic-time internal pattern matching queries in compressed and dynamic texts. In: Lipták, Z., et al. (eds.) SPIRE 2024. LNCS, vol. 14899, pp. 102–117, Springer, Cham (2024). https://doi.org/10.1007/978-3-031-72200-4_8

  21. Farach, M.: Optimal suffix tree construction with large alphabets. In: 38th Annual Symposium on Foundations of Computer Science, FOCS 1997, Miami Beach, 19–22 October 1997, pp. 137–143. IEEE Computer Society (1997). https://doi.org/10.1109/SFCS.1997.646102

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

  23. Flouri, T., et al.: Enhanced string covering. Theor. Comput. Sci. 506, 102–114 (2013). https://doi.org/10.1016/J.TCS.2013.08.013

  24. Ganardi, M., Jeż, A., Lohrey, M.: Balancing straight-line programs. J. ACM 68(4), 27:1–27:40 (2021). https://doi.org/10.1145/3457389

  25. 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, 7–10 January 2018, pp. 1509–1528. SIAM (2018). https://doi.org/10.1137/1.9781611975031.99

  26. Hariharan, R., Vinay, V.: String matching in Õ(sqrt(n)+sqrt(m)) quantum time. J. Discrete Algorithms 1(1), 103–110 (2003). https://doi.org/10.1016/S1570-8667(03)00010-8

    Article  MathSciNet  Google Scholar 

  27. I, T., et al.: Detecting regularities on grammar-compressed strings. Inf. Comput. 240, 74–89 (2015). https://doi.org/10.1016/J.IC.2014.09.009

  28. Jin, C., Nogler, J.: Quantum speed-ups for string synchronizing sets, longest common substring, and k-mismatch matching. In: Bansal, N., Nagarajan, V. (eds.) Proceedings of the 2023 ACM-SIAM Symposium on Discrete Algorithms, SODA 2023, Florence, 22–25 January 2023, pp. 5090–5121. SIAM (2023). https://doi.org/10.1137/1.9781611977554.CH186

  29. Kempa, D., Kociumaka, T.: String synchronizing sets: sublinear-time BWT construction and optimal LCE data structure. In: Charikar, M., Cohen, E. (eds.) Proceedings of the 51st Annual ACM SIGACT Symposium on Theory of Computing, STOC 2019, Phoenix, 23–26 June 2019, pp. 756–767. ACM (2019). https://doi.org/10.1145/3313276.3316368

  30. Kempa, D., Kociumaka, T.: Dynamic suffix array with polylogarithmic queries and updates. In: Leonardi, S., Gupta, A. (eds.) STOC 2022: 54th Annual ACM SIGACT Symposium on Theory of Computing, Rome, 20–24 June 2022, pp. 1657–1670. ACM (2022). https://doi.org/10.1145/3519935.3520061

  31. Knuth, D.E., Jr., J.H.M., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6(2), 323–350 (1977). https://doi.org/10.1137/0206024

  32. Kociumaka, T., Kubica, M., Radoszewski, J., Rytter, W., Waleń, T.: A linear-time algorithm for seeds computation. ACM Trans. Algorithms 16(2), 27:1–27:23 (2020). https://doi.org/10.1145/3386369

  33. Kociumaka, T., Radoszewski, J., Rytter, W., Waleń, T.: Internal pattern matching queries in a text and applications. arXiv preprint arXiv:1311.6235 (2013)

  34. Kociumaka, T., Radoszewski, J., Rytter, W., Waleń, T.: Internal pattern matching queries in a text and applications. In: Indyk, P. (ed.) Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, San Diego, 4–6 January 2015, pp. 532–551. SIAM (2015). https://doi.org/10.1137/1.9781611973730.36

  35. Mitani, K., Mieno, T., Seto, K., Horiyama, T.: Shortest cover after edit. In: Inenaga, S., Puglisi, S.J. (eds.) 35th Annual Symposium on Combinatorial Pattern Matching, CPM 2024, 25–27 June 2024, Fukuoka. LIPIcs, vol. 296, pp. 24:1–24:15. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2024). https://doi.org/10.4230/LIPICS.CPM.2024.24

  36. Moore, D.W.G., Smyth, W.F.: A correction to “An optimal algorithm to compute all the covers of a string’’. Inf. Process. Lett. 54(2), 101–103 (1995). https://doi.org/10.1016/0020-0190(94)00235-Q

    Article  Google Scholar 

  37. Munro, J.I., Navarro, G., Nekrich, Y.: Text indexing and searching in sublinear time. In: Gørtz, I.L., Weimann, O. (eds.) 31st Annual Symposium on Combinatorial Pattern Matching, CPM 2020, 17–19 June 2020, Copenhagen. LIPIcs, vol. 161, pp. 24:1–24:15. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2020). https://doi.org/10.4230/LIPICS.CPM.2020.24

  38. Plandowski, W., Rytter, W.: Application of Lempel-Ziv encodings to the solution of words equations. In: Larsen, K.G., Skyum, S., Winskel, G. (eds.) ICALP 1998. LNCS, vol. 1443, pp. 731–742. Springer, Heidelberg (1998). https://doi.org/10.1007/BFB0055097

  39. Radoszewski, J.: Linear time construction of cover suffix tree and applications. In: Gørtz, I.L., Farach-Colton, M., Puglisi, S.J., Herman, G. (eds.) 31st Annual European Symposium on Algorithms, ESA 2023, 4–6 September 2023, Amsterdam. LIPIcs, vol. 274, pp. 89:1–89:17. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2023). https://doi.org/10.4230/LIPICS.ESA.2023.89

  40. Singh, M.: Quasiperiodicity in Tribonacci Word (2020). https://hal.science/hal-02141636. Working paper or preprint

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Wiktor Zuba .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Radoszewski, J., Zuba, W. (2025). Computing String Covers in Sublinear Time. In: Lipták, Z., Moura, E., Figueroa, K., Baeza-Yates, R. (eds) String Processing and Information Retrieval. SPIRE 2024. Lecture Notes in Computer Science, vol 14899. Springer, Cham. https://doi.org/10.1007/978-3-031-72200-4_21

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-72200-4_21

  • Published:

  • Publisher Name: Springer, Cham

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

  • Online ISBN: 978-3-031-72200-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics