Skip to main content

How to Answer a Small Batch of RMQs or LCA Queries in Practice

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

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 10765))

Included in the following conference series:

Abstract

In the Range Minimum Query (RMQ) problem, we are given an array A of n numbers and we are asked to answer queries of the following type: for indices i and j between 0 and \(n-1\), query \(\text {RMQ}_A(i,j)\) returns the index of a minimum element in the subarray \(A[i\mathinner {.\,.}j]\). Answering a small batch of RMQs is a core computational task in many real-world applications, in particular due to the connection with the Lowest Common Ancestor (LCA) problem. With small batch, we mean that the number q of queries is o(n) and we have them all at hand. It is therefore not relevant to build an \(\varOmega (n)\)-sized data structure or spend \(\varOmega (n)\) time to build a more succinct one. It is well-known, among practitioners and elsewhere, that these data structures for online querying carry high constants in their pre-processing and querying time. We would thus like to answer this batch efficiently in practice. With efficiently in practice, we mean that we (ultimately) want to spend \(n + \mathcal {O}(q)\) time and \(\mathcal {O}(q)\) space. We write n to stress that the number of operations per entry of A should be a very small constant. Here we show how existing algorithms can be easily modified to satisfy these conditions. The presented experimental results highlight the practicality of this new scheme. The most significant improvement obtained is for answering a small batch of LCA queries. A library implementation of the presented algorithms is made available.

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

References

  1. Afshani, P., Sitchinava, N.: I/O-efficient range minima queries. In: Ravi, R., Gørtz, I.L. (eds.) SWAT 2014. LNCS, vol. 8503, pp. 1–12. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-08404-6_1

    Chapter  Google Scholar 

  2. Arge, L., Fischer, J., Sanders, P., Sitchinava, N.: On (dynamic) range minimum queries in external memory. In: Dehne, F., Solis-Oba, R., Sack, J.-R. (eds.) WADS 2013. LNCS, vol. 8037, pp. 37–48. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-40104-6_4

    Chapter  Google Scholar 

  3. Athar, T., Barton, C., Bland, W., Gao, J., Iliopoulos, C.S., Liu, C., Pissis, S.P.: Fast circular dictionary-matching algorithm. Math. Struct. Comput. Sci. 27(2), 143–156 (2017)

    Article  MathSciNet  Google Scholar 

  4. 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). https://doi.org/10.1007/10719839_9

    Chapter  Google Scholar 

  5. Bender, M.A., Farach-Colton, M., Pemmasani, G., Skiena, S., Sumazin, P.: Lowest common ancestors in trees and directed acyclic graphs. J. Algorithms 57(2), 75–94 (2005)

    Article  MathSciNet  Google Scholar 

  6. Berkman, O., Vishkin, U.: Recursive star-tree parallel data structure. SIAM J. Comput. 22(2), 221–242 (1993)

    Article  MathSciNet  Google Scholar 

  7. Crochemore, M., Hancart, C., Lecroq, T.: Algorithms on Strings. Cambridge University Press, Cambridge (2007)

    Book  Google Scholar 

  8. Ferrada, H., Navarro, G.: Improved range minimum queries. J. Discret. Algorithms 43, 72–80 (2016)

    Article  MathSciNet  Google Scholar 

  9. Fischer, J., Heun, V.: Theoretical and practical improvements on the RMQ-problem, with applications to LCA and LCE. In: Lewenstein, M., Valiente, G. (eds.) CPM 2006. LNCS, vol. 4009, pp. 36–48. Springer, Heidelberg (2006). https://doi.org/10.1007/11780441_5

    Chapter  Google Scholar 

  10. Gabow, H.N., Bentley, J.L., Tarjan, R.E.: Scaling and related techniques for geometry problems. In: STOC 1984, pp. 135–143. ACM (1984)

    Google Scholar 

  11. Gabow, H.N., Tarjan, R.E.: A linear-time algorithm for a special case of disjoint set union. J. Comput. Syst. Sci. 30(2), 209–221 (1985)

    Article  MathSciNet  Google Scholar 

  12. Geary, R.F., Rahman, N., Raman, R., Raman, V.: A simple optimal representation for balanced parentheses. Theoret. Comput. Sci. 368(3), 231–246 (2006)

    Article  MathSciNet  Google Scholar 

  13. Gog, S., Beller, T., Moffat, A., Petri, M.: From theory to practice: plug and play with succinct data structures. In: Gudmundsson, J., Katajainen, J. (eds.) SEA 2014. LNCS, vol. 8504, pp. 326–337. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-07959-2_28

    Chapter  Google Scholar 

  14. Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13(2), 338–355 (1984)

    Article  MathSciNet  Google Scholar 

  15. Ilie, L., Navarro, G., Tinta, L.: The longest common extension problem revisited and applications to approximate string searching. J. Discret. Algorithms 8(4), 418–428 (2010)

    Article  MathSciNet  Google Scholar 

  16. Iliopoulos, C., Mchugh, J., Peterlongo, P., Pisanti, N., Rytter, W., Sagot, M.-F.: A first approach to finding common motifs with gaps. Int. J. Found. Comput. Sci. 16(6), 1145–1155 (2005)

    Article  MathSciNet  Google Scholar 

  17. Kociumaka, T., Pissis, S.P., Radoszewski, J.: Pattern matching and consensus problems on weighted sequences and profiles. In: ISAAC 2016. LIPIcs, vol. 64, pp. 46:1–46:12. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (2016)

    Google Scholar 

  18. Mäkinen, V., Belazzougui, D., Cunial, F., Tomescu, A.I.: Genome-Scale Algorithm Design: Biological Sequence Analysis in the Era of High-Throughput Sequencing. Cambridge University Press, Cambridge (2015)

    Book  Google Scholar 

  19. Pinter, R.Y.: Efficient string matching with don’t-care patterns. In: Apostolico, A., Galil, Z. (eds.) Combinatorial Algorithms on Words. NATO ASI Series, vol. F12, pp. 11–29. Springer, Heidelberg (1985). https://doi.org/10.1007/978-3-642-82456-2_2

    Chapter  Google Scholar 

  20. Pissis, S.P.: MoTeX-II: structured motif extraction from large-scale datasets. BMC Bioinform. 15, 235 (2014)

    Article  Google Scholar 

  21. Régnier, M., Jacquet, P.: New results on the size of tries. IEEE Trans. Inf. Theory 35(1), 203–205 (1989)

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Panagiotis Charalampopoulos .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer International Publishing AG, part of Springer Nature

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Alzamel, M., Charalampopoulos, P., Iliopoulos, C.S., Pissis, S.P. (2018). How to Answer a Small Batch of RMQs or LCA Queries in Practice. In: Brankovic, L., Ryan, J., Smyth, W. (eds) Combinatorial Algorithms. IWOCA 2017. Lecture Notes in Computer Science(), vol 10765. Springer, Cham. https://doi.org/10.1007/978-3-319-78825-8_28

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-78825-8_28

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-78824-1

  • Online ISBN: 978-3-319-78825-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics