Abstract
In this paper, we define the Range LCP problem as follows. Preprocess a string S, of length n, to enable efficient solutions of the following query:
Given \([i,j],\ \ 0< i \leq j \leq n\), compute max ℓ, k ∈ {i,…,j} LCP(S ℓ, S k ), where LCP(S ℓ, S k ) is the length of the longest common prefix of the suffixes of S starting at locations ℓ and k. This is a natural generalization of the classical LCP problem.
Surprisingly, while it is known how to preprocess a string in linear time to enable LCP computation of two suffixes in constant time, this seems quite difficult in the Range LCP problem. It is trivial to answer such queries in time O(|j − i|2) after a linear-time preprocessing and easy to show an O(1) query algorithm after an O(|S|2) time preprocessing. We provide algorithms that solve the problem with the following complexities:
-
1
Preprocessing Time: O(|S|), Space: O(|S|), Query Time: O(|j − i|loglogn).
-
2
Preprocessing Time: no preprocessing, Space: O(|j − i|log|j − i|), Query Time: O(|j − i|log|j − i|). However, the query just gives the pairs with the longest LCP, not the LCP itself.
-
3
Preprocessing Time: O(|S|log2 |S|), Space: O(|S|log1 + ε |S|) for arbitrary small constant ε, Query Time: O(loglog|S|).
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Apostolico, A., Preparata, F.P.: Optimal off-line detection of repetitions in a string. Theoretical Computer Science 22, 297–315 (1983)
Berkman, O., Breslauer, D., Galil, Z., Schieber, B., Vishkin, U.: Highly parallelizable problems. In: Proc. 21st ACM Symposium on Theory of Computation, pp. 309–319 (1989)
Chan, T.M., Larsen, K.G., Pǎtraşcu, M.: Orthogonal range searching on the ram, revisited. In: Proc. 27th ACM Symposium on Computational Geometry (SoCG), pp. 1–10 (2011)
Cormode, G., Muthukrishnan, S.: Substring compression problems. In: Proc. 16th annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pp. 321–330 (2005)
Farach, M.: Optimal suffix tree construction with large alphabets. In: Proc. 38th IEEE Symposium on Foundations of Computer Science, pp. 137–143 (1997)
Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestor. Journal of Computer and System Science 13, 338–355 (1984)
Iacono, J., Özkan, Ö.: Mergeable Dictionaries. In: Abramsky, S., Gavoille, C., Kirchner, C., Meyer auf der Heide, F., Spirakis, P.G. (eds.) ICALP 2010. LNCS, Part I, vol. 6198, pp. 164–175. Springer, Heidelberg (2010)
Kärkkäinen, J., Sanders, P.: Simple Linear Work Suffix Array Construction. In: Baeten, J.C.M., Lenstra, J.K., Parrow, J., Woeginger, G.J. (eds.) ICALP 2003. LNCS, vol. 2719, pp. 943–955. Springer, Heidelberg (2003)
Kasai, T., Lee, G., Arimura, H., Arikawa, S., Park, K.: Linear-Time Longest-Common-Prefix Computation in Suffix Arrays and Its Applications. In: Amir, A., Landau, G.M. (eds.) CPM 2001. LNCS, vol. 2089, pp. 181–192. Springer, Heidelberg (2001)
Keller, O., Kopelowitz, T., Landau, S., Lewenstein, M.: Generalized Substring Compression. In: Kucherov, G., Ukkonen, E. (eds.) CPM 2009 Lille. LNCS, vol. 5577, pp. 26–38. Springer, Heidelberg (2009)
Landau, G.M., Vishkin, U.: Fast parallel and serial approximate string matching. Journal of Algorithms 10(2), 157–169 (1989)
Lempel, A., Ziv, J.: On the complexity of finite sequences. IEEE Transactions on Information Theory 22, 75–81 (1976)
McCreight, E.M.: A space-economical suffix tree construction algorithm. J. of the ACM 23, 262–272 (1976)
Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14, 249–260 (1995)
van Emde Boas, P., Kaas, R., Zijlstra, E.: Design and implementation of an efficient priority queue. Mathematical Systems Theory 10, 99–127 (1977)
Weiner, P.: Linear pattern matching algorithm. In: Proc. 14 IEEE Symposium on Switching and Automata Theory, pp. 1–11 (1973)
Yuan, H., Atallah, M.J.: Data structures for range minimum queries in multidimensional arrays. In: Proc. 21st ACM-SIAM Symposium on Discrete Algorithms (SODA), pp. 150–160 (2010)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2011 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Amir, A., Apostolico, A., Landau, G.M., Levy, A., Lewenstein, M., Porat, E. (2011). Range LCP. In: Asano, T., Nakano, Si., Okamoto, Y., Watanabe, O. (eds) Algorithms and Computation. ISAAC 2011. Lecture Notes in Computer Science, vol 7074. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-25591-5_70
Download citation
DOI: https://doi.org/10.1007/978-3-642-25591-5_70
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-25590-8
Online ISBN: 978-3-642-25591-5
eBook Packages: Computer ScienceComputer Science (R0)