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.
Similar content being viewed by others
References
Allison L.: Longest biased interval and longest non-negative sum interval. Bioinformatics 19(10), 1294–1295 (2003)
Bender, M.A., Farach-Colton, M.: The LCA problem revisited. In: Gonnet, G.H., Panario, D., Viola, A. (eds.) LATIN, pp. 88–94. (2000)
Bentley J.L.: Algorithm design techniques. Commun. ACM 27(9), 865–871 (1984)
Berkman, O., Breslauer, D., Galil, Z., Schieber, B., Vishkin, U.: Highly parallelizable problems (extended abstract). In: STOC, pp. 309–319. ACM, New York (1989)
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)
Chen K.-Y., Chao K.-M.: On the range maximum-sum segment query problem. Discrete Appl. Math. 155(16), 2043–2052 (2007)
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)
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)
Demaine, E.: Cache-oblivious algorithms and data structures. In: Lecture Notes from the EEF Summer School on Massive Data Sets (2002)
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)
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)
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
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)
Harel D., Tarjan R.E.: Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13(2), 338–355 (1984)
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)
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)
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)
min Chung K., Lu H.-I.: An optimal algorithm for the maximum-density segment problem. SIAM J. Comput. 34(2), 373–387 (2004)
Muthukrishnan, S.: Efficient algorithms for document retrieval problems. In: ACM-SIAM Symposium on Discrete Algorithms, pp. 657–666 (2002)
Prokop, H.: Cache-oblivious algorithms. Master’s thesis, Massachusetts Institute of Technology, Dept. of Electrical Engineering and Computer Science (1999)
Sadakane K.: Succinct data structures for flexible text retrieval systems. J. Discrete Algorithms 5(1), 12–22 (2007)
Schieber B., Vishkin U.: On finding lowest common ancestors: simplification and parallelization. SIAM J. Comput. 17(6), 1253–1262 (1988)
Vitter, J.S.: External memory algorithms. In: PODS, pp. 119–128. ACM Press, New York (1998)
Wang, L., Xu, Y.: Segid: Identifying interesting segments in (multiple) sequence alignments. Bioinformatics 19(2), 297–298 (2003)
Author information
Authors and Affiliations
Corresponding author
Additional information
This research is part of the B.Sc. Engg. Thesis work of Tanaeem M. Moosa.
Rights 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
Received:
Revised:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s11786-010-0037-2