Theoretical and Practical Improvements on the RMQ-Problem, with Applications to LCA and LCE

  • Johannes Fischer
  • Volker Heun
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4009)


The Range-Minimum-Query-Problem is to preprocess an array such that the position of the minimum element between two specified indices can be obtained efficiently. We present a direct algorithm for the general RMQ-problem with linear preprocessing time and constant query time, without making use of any dynamic data structure. It consumes less than half of the space that is needed by the method by Berkman and Vishkin. We use our new algorithm for RMQ to improve on LCA-computation for binary trees, and further give a constant-time LCE-algorithm solely based on arrays. Both LCA and LCE have important applications, e.g., in computational biology. Experimental studies show that our new method is almost twice as fast in practice as previous approaches, and asymptotically slower variants of the constant-time algorithms perform even better for today’s common problem sizes.


Binary Tree Query Time Extra Space Lower Common Ancestor Query Length 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aho, A.V., Hopcroft, J.E., Ullman, J.D.: On finding lowest common ancestors in trees. SIAM J. Comput. 5, 115–132 (1976)CrossRefMathSciNetzbMATHGoogle Scholar
  2. 2.
    Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13, 338–355 (1984)CrossRefMathSciNetzbMATHGoogle Scholar
  3. 3.
    Schieber, B., Vishkin, U.: On finding lowest common ancestors: Simplification and parallelization. SIAM J. Comput. 17, 1253–1262 (1988)CrossRefMathSciNetzbMATHGoogle Scholar
  4. 4.
    Berkman, O., Vishkin, U.: Recursive star-tree parallel data structure. SIAM J. Comput. 22 (1993)Google Scholar
  5. 5.
    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)CrossRefGoogle Scholar
  6. 6.
    Bender, M.A., Farach-Colton, M., Pemmasani, G., Skiena, S., Sumazin, P.: Lowest common ancestors in trees and directed acyclic graphs. J. Algorithms 57, 75–94 (2005)CrossRefMathSciNetzbMATHGoogle Scholar
  7. 7.
    Gabow, H.N., Bentley, J.L., Tarjan, R.E.: Scaling and related techniques for geometry problems. In: Proc. of the ACM STOC, pp. 135–143. ACM Press, New York (1984)Google Scholar
  8. 8.
    Gonnet, G.H., Baeza-Yates, R.A., Snider, T.: New indices for text: PAT trees and PAT arrays. In: Frakes, W.B., Baeza-Yates, R.A. (eds.) Information Retrieval: Data Structures and Algorithms, pp. 66–82. Prentice-Hall, Englewood Cliffs (1992)Google Scholar
  9. 9.
    Manber, U., Myers, E.W.: Suffix arrays: A new method for on-line string searches. SIAM J. Comput. 22, 935–948 (1993)CrossRefMathSciNetzbMATHGoogle Scholar
  10. 10.
    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
  11. 11.
    Abouelhoda, M.I., Kurtz, S., Ohlebusch, E.: Replacing suffix trees with enhanced suffix arrays. J. Discrete Algorithms 2, 53–86 (2004)CrossRefMathSciNetzbMATHGoogle Scholar
  12. 12.
    Alstrup, S., Gavoille, C., Kaplan, H., Rauhe, T.: Nearest common ancestors: A survey and a new distributed algorithm. In: Proc. SPAA, pp. 258–264. ACM Press, New York (2002)Google Scholar
  13. 13.
    Vuillemin, J.: A unifying look at data structures. Comm. ACM 23, 229–239 (1980)CrossRefMathSciNetzbMATHGoogle Scholar
  14. 14.
    Tarjan, R.E., Vishkin, U.: An efficient parallel biconnectivity algorithm. SIAM J. Comput. 14, 862–874 (1985)CrossRefMathSciNetzbMATHGoogle Scholar
  15. 15.
    Arlazarov, V.L., Dinic, E.A., Kronrod, M.A., Faradzev, I.A.: On economic construction of the transitive closure of a directed graph. Dokl. Acad. Nauk. SSSR 194, 487–488 (1970) (in Russian), Engl. transl. in Soviet Math. Dokl. 11, 1209–1210 (1975)Google Scholar
  16. 16.
    Knuth, D.E.: The Art of Computer Programming. Generating All Trees; History of Combinatorial Generation, vol. 4, fasc. 4. Addison-Wesley, Reading (2006)Google Scholar
  17. 17.
    Main, M.G., Lorentz, R.J.: An O(n logn) algorithm for finding all repetitions in a string. J. Algorithms 5, 422–432 (1984)CrossRefMathSciNetzbMATHGoogle Scholar
  18. 18.
    Gusfield, D., Stoye, J.: Linear time algorithm for finding and representing all tandem repeats in a string. J. Comput. Syst. Sci. 69, 525–546 (2004)CrossRefMathSciNetzbMATHGoogle Scholar
  19. 19.
    Landau, G., Schmidt, J.P., Sokol, D.: An algorithm for approximate tandem repeats. J. Comput. Biol. 8, 1–18 (2001)CrossRefGoogle Scholar
  20. 20.
    Myers, E.W.: An O(nd) difference algorithm and its variations. Algorithmica 1, 251–266 (1986)CrossRefMathSciNetzbMATHGoogle Scholar
  21. 21.
    Landau, G., Vishkin, U.: Introducing efficient parallelism into approximate string matching and a new serial algorithm. In: Proc. STOC, pp. 220–230. ACM Press, New York (1986)Google Scholar
  22. 22.
    Gusfield, D.: Algorithms on Strings, Trees, and Sequences. Cambridge University Press, Cambridge (1997)CrossRefzbMATHGoogle Scholar
  23. 23.
    Schürmann, K.B., Stoye, J.: An incomplex algorithm for fast suffix array construction. In: Proc. ALENEX/ANALCO, pp. 77–85. SIAM Press, Philadelphia (2005)Google Scholar
  24. 24.
    Manzini, G.: Two space saving tricks for linear time lcp array computation. In: Hagerup, T., Katajainen, J. (eds.) SWAT 2004. LNCS, vol. 3111, pp. 372–383. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  25. 25.
    Sadakane, K.: Succinct representations of lcp information and improvements in the compressed suffix arrays. In: Proc. SODA, pp. 225–237. ACM/SIAM (2002)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Johannes Fischer
    • 1
  • Volker Heun
    • 1
  1. 1.Institut für InformatikLudwig-Maximilian Universität MünchenMünchenGermany

Personalised recommendations