Range LCP
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|).
Keywords
Query Time Query Algorithm Preprocessing Time Succinct Representation Marked LeafPreview
Unable to display preview. Download preview PDF.
References
- 1.Apostolico, A., Preparata, F.P.: Optimal off-line detection of repetitions in a string. Theoretical Computer Science 22, 297–315 (1983)MathSciNetCrossRefMATHGoogle Scholar
- 2.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)Google Scholar
- 3.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)Google Scholar
- 4.Cormode, G., Muthukrishnan, S.: Substring compression problems. In: Proc. 16th annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pp. 321–330 (2005)Google Scholar
- 5.Farach, M.: Optimal suffix tree construction with large alphabets. In: Proc. 38th IEEE Symposium on Foundations of Computer Science, pp. 137–143 (1997)Google Scholar
- 6.Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestor. Journal of Computer and System Science 13, 338–355 (1984)MathSciNetMATHGoogle Scholar
- 7.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)CrossRefGoogle Scholar
- 8.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)CrossRefGoogle Scholar
- 9.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)CrossRefGoogle Scholar
- 10.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)CrossRefGoogle Scholar
- 11.Landau, G.M., Vishkin, U.: Fast parallel and serial approximate string matching. Journal of Algorithms 10(2), 157–169 (1989)MathSciNetCrossRefMATHGoogle Scholar
- 12.Lempel, A., Ziv, J.: On the complexity of finite sequences. IEEE Transactions on Information Theory 22, 75–81 (1976)MathSciNetCrossRefMATHGoogle Scholar
- 13.McCreight, E.M.: A space-economical suffix tree construction algorithm. J. of the ACM 23, 262–272 (1976)MathSciNetCrossRefMATHGoogle Scholar
- 14.Ukkonen, E.: On-line construction of suffix trees. Algorithmica 14, 249–260 (1995)MathSciNetCrossRefMATHGoogle Scholar
- 15.van Emde Boas, P., Kaas, R., Zijlstra, E.: Design and implementation of an efficient priority queue. Mathematical Systems Theory 10, 99–127 (1977)MathSciNetCrossRefMATHGoogle Scholar
- 16.Weiner, P.: Linear pattern matching algorithm. In: Proc. 14 IEEE Symposium on Switching and Automata Theory, pp. 1–11 (1973)Google Scholar
- 17.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)Google Scholar