Skip to main content
Log in

Cache Oblivious Algorithms for the RMQ and the RMSQ Problems

  • Published:
Mathematics in Computer Science Aims and scope Submit manuscript

Abstract

In the Range Minimum/Maximum Query (RMQ) and Range Maximum-Sum Segment Query (RMSQ) problems, we are given an array which we can preprocess in order to answer subsequent queries. In the RMQ query, we are given a range on the array and we need to find the maximum/minimum element within that range. On the other hand, in RMSQ query, we need to return the segment within the given query range that gives the maximum sum. In this paper, we present cache oblivious optimal algorithms for both of the above problems. In particular, for both the problems, we have presented linear time data structures having optimal cache miss. The data structures can answer the corresponding queries in constant time with constant cache miss.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Allison L.: Longest biased interval and longest non-negative sum interval. Bioinformatics 19(10), 1294–1295 (2003)

    Article  Google Scholar 

  2. Bender, M.A., Farach-Colton, M.: The LCA problem revisited. In: Gonnet, G.H., Panario, D., Viola, A. (eds.) LATIN, pp. 88–94. (2000)

  3. Bentley J.L.: Algorithm design techniques. Commun. ACM 27(9), 865–871 (1984)

    Article  MathSciNet  Google Scholar 

  4. Berkman, O., Breslauer, D., Galil, Z., Schieber, B., Vishkin, U.: Highly parallelizable problems (extended abstract). In: STOC, pp. 309–319. ACM, New York (1989)

  5. Chen K.-Y., Chao K.-M.: Optimal algorithms for locating the longest and shortest segments satisfying a sum or an average constraint. Inf. Process. Lett. 96(6), 197–201 (2005)

    Article  MATH  MathSciNet  Google Scholar 

  6. Chen K.-Y., Chao K.-M.: On the range maximum-sum segment query problem. Discrete Appl. Math. 155(16), 2043–2052 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  7. Crochemore, M., Iliopoulos, C.S., Rahman, M.S.: Finding patterns in given intervals. In: Kucera, L., Kucera, A. (eds.) MFCS. Lecture Notes in Computer Science, vol. 4708 pp. 645–656. Springer, Berlin (2007)

  8. Crochemore, M., Iliopoulos, C.S., Rahman, M.S.: Optimal prefix and suffix queries on texts. In: Jacquet, P. (ed.) AofA, DMTCS Proc., AH, pp. 645–656 (2007)

  9. Demaine, E.: Cache-oblivious algorithms and data structures. In: Lecture Notes from the EEF Summer School on Massive Data Sets (2002)

  10. Demaine, E.D., Landau, G.M., Weimann, O.: On cartesian trees and range minimum queries. In: Albers, S., Marchetti-Spaccamela, A., Matias, Y., Nikoletseas, S.E., Thomas, W. (eds.) ICALP (1). Lecture Notes in Computer Science, vol. 5555, pp. 341–353. Springer, Berlin (2009)

  11. Fan, T.-H., Lee, S., Lu, H.-I., Tsou, T.-S., Wang, T.-C., Yao, A.: An optimal algorithm for maximum-sum segment and its application in bioinformatics extended abstract. In: Ibarra, O.H., Dang, Z. (eds.) CIAA. Lecture Notes in Computer Science, vol. 2759, pp. 251–257. Springer, Berlin (2003)

  12. Frigo, M., Leiserson, C.E., Prokop, H., Ramachandran, S.: Cache-oblivious algorithms. In: 40th Annual Symposium on Foundations of Computer Science (FOCS ’99), IEEE, Washington, Brussels, Tokyo, Oct. 1999

  13. Gabow, H., Bentley, J., Tarjan, R.: Scaling and related techniques for geometry problems. In: Symposium on the Theory of Computing (STOC), pp. 135–143. ACM, New York (1984)

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

    Article  MATH  MathSciNet  Google Scholar 

  15. Johannes Fischer, V.H.: A new succinct representation of RMQ-information and improvements in the enhanced suffix array. In: Chen, B., Zhang, G. (eds.) ESCAPE. Lecture Notes in Computer Science, vol. 4614, pp. 459–470. Springer, Berlin (2007)

  16. Lin Y.-L., Huang X., Jiang T., Chao K.-M.: Mavg: locating non-overlapping maximum average segments in a given sequence. Bioinformatics 19(1), 151–152 (2003)

    Article  Google Scholar 

  17. Lin Y.-L., Jiang T., Chao K.-M.: Efficient algorithms for locating the length-constrained heaviest segments with applications to biomolecular sequence analysis. J. Comput. Syst. Sci. 65(3), 570–586 (2002)

    Article  MATH  MathSciNet  Google Scholar 

  18. min Chung K., Lu H.-I.: An optimal algorithm for the maximum-density segment problem. SIAM J. Comput. 34(2), 373–387 (2004)

    Article  MATH  MathSciNet  Google Scholar 

  19. Muthukrishnan, S.: Efficient algorithms for document retrieval problems. In: ACM-SIAM Symposium on Discrete Algorithms, pp. 657–666 (2002)

  20. Prokop, H.: Cache-oblivious algorithms. Master’s thesis, Massachusetts Institute of Technology, Dept. of Electrical Engineering and Computer Science (1999)

  21. Sadakane K.: Succinct data structures for flexible text retrieval systems. J. Discrete Algorithms 5(1), 12–22 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  22. Schieber B., Vishkin U.: On finding lowest common ancestors: simplification and parallelization. SIAM J. Comput. 17(6), 1253–1262 (1988)

    Article  MATH  MathSciNet  Google Scholar 

  23. Vitter, J.S.: External memory algorithms. In: PODS, pp. 119–128. ACM Press, New York (1998)

  24. Wang, L., Xu, Y.: Segid: Identifying interesting segments in (multiple) sequence alignments. Bioinformatics 19(2), 297–298 (2003)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to M. Sohel Rahman.

Additional information

This research is part of the B.Sc. Engg. Thesis work of Tanaeem M. Moosa.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Hasan, M., Moosa, T.M. & Rahman, M.S. Cache Oblivious Algorithms for the RMQ and the RMSQ Problems. Math.Comput.Sci. 3, 433–442 (2010). https://doi.org/10.1007/s11786-010-0037-2

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11786-010-0037-2

Keywords

Mathematics Subject Classification (2000)

Navigation