SWAT 2014: Algorithm Theory – SWAT 2014 pp 1-12

# I/O-Efficient Range Minima Queries

• Peyman Afshani
• Nodari Sitchinava
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8503)

## Abstract

In this paper we study the offline (batched) range minima query (RMQ) problem in the external memory (EM) and cache-oblivious (CO) models. In the static RMQ problem, given an array A, a query rmq A (i,j) returns the smallest element in the range A[i,j].

If B is the size of the block and m is the number of blocks that fit in the internal memory in the EM and CO models, we show that Q range minima queries on an array of size N can be answered in O$$({{{N}\over{B}} + {{Q}\over{B}}\log_{m}{{Q}\over{B}}}) = {\rm O}{({\rm scan}({N}) + {\rm sort}({Q}))}$$ I/Os in the CO model and slightly better O$$({{\rm scan}({N}) + {{Q}\over{B}} \log_m \min\{{{Q}\over{B}}, {{N}\over{B}}\}})$$ I/Os in the EM model and linear space in both models. Our cache-oblivious result is new and our external memory result is an improvement of the previously known bound. We also show that the EM bound is tight by proving a matching lower bound. Our lower bound holds even if the queries are presorted in any predefined order.

In the batched dynamic RMQ problem, the queries must be answered in the presence of the updates (insertions/deletions) to the array. We show that in the EM model we can solve this problem in O$$({{\rm sort}({N}) + {\rm sort}{Q}\log_m {{N}\over{B}}})$$ I/Os, again improving the best previously known bound.

## Keywords

External Memory Internal Memory Merging Process Input Query Atomic Element
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.

## References

1. 1.
Aggarwal, A., Vitter, J.S.: The input/output complexity of sorting and related problems. Communications of the ACM 31, 1116–1127 (1988)
2. 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)
3. 3.
Bender, M.A., Farach-Colton, M.: The LCA problem revisited. In: Proc. 4th Latin American Theoretical Informatics Symposium, pp. 88–94 (2000)Google Scholar
4. 4.
Brodal, G.S., Fagerberg, R.: Cache oblivious distribution sweeping. In: Proc. 29th International Colloquium on Automata, Languages, and Programming, pp. 426–438 (2002)Google Scholar
5. 5.
Chiang, Y.J., Goodrich, M.T., Grove, E.F., Tamassia, R., Vengroff, D.E., Vitter, J.S.: External-memory graph algorithms. In: Proc. 6th ACM/SIAM Symposium on Discrete Algorithms, pp. 139–149 (1995)Google Scholar
6. 6.
Demaine, E.D., Landau, G.M., Weimann, O.: On cartesian trees and range minimum queries. Algorithmica 68(3), 610–625 (2014)
7. 7.
Fischer, J., Heun, V.: Space-efficient preprocessing schemes for range minimum queries on static arrays. SIAM Journal on Computing 40(2), 465–492 (2011)
8. 8.
Fischer, J.: Optimal succinctness for range minimum queries. In: Proc. 9th Latin American Theoretical Informatics Symposium, pp. 158–169 (2010)Google Scholar
9. 9.
Frigo, M., Leiserson, C.E., Prokop, H., Ramachandran, S.: Cache-oblivious algorithms. In: Proc. 40th IEEE Symposium on Foundations of Computer Science, pp. 285–297 (1999)Google Scholar
10. 10.
Gabow, H.N., Bentley, J.L., Tarjan, R.E.: Scaling and related techniques for geometry problems. In: Proc. 16th ACM Symposium on Theory of Computation, pp. 135–143 (1984)Google Scholar
11. 11.
Hasan, M., Moosa, T.M., Rahman, M.S.: Cache oblivious algorithms for the RMQ and the RMSQ problems. Mathematics in Computer Science 3(4), 433–442 (2010)
12. 12.
Vuillemin, J.: A unifying look at data structures. Comm. ACM 23(4), 229–239 (1980)

© Springer International Publishing Switzerland 2014

## Authors and Affiliations

• Peyman Afshani
• 1
• Nodari Sitchinava
• 2
1. 1.MADALGO, Department of Computer ScienceUniversity of AarhusDenmark
2. 2.Department of Information and Computer SciencesUniv. of Hawaii – ManoaUSA