A Data Structure for the Maximum-Sum Segment Problem with Offsets

Author Yoshifumi Sakai

Thumbnail PDF


  • Filesize: 0.94 MB
  • 15 pages

Document Identifiers

Author Details

Yoshifumi Sakai
  • Graduate School of Agricultural Science, Tohoku University, Japan

Cite AsGet BibTex

Yoshifumi Sakai. A Data Structure for the Maximum-Sum Segment Problem with Offsets. In 35th Annual Symposium on Combinatorial Pattern Matching (CPM 2024). Leibniz International Proceedings in Informatics (LIPIcs), Volume 296, pp. 26:1-26:15, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024)


Consider a variant of the maximum-sum segment problem for a sequence X₀ of n real numbers, which asks an arbitrary contiguous subsequence of X_a that maximizes the sum of its elements for any given real number a, where X_a is the sequence obtained by subtracting a from each element in X₀. Although this problem can be solved in O(n) time from scratch for any given X₀ and a, appropriate data structures for X₀ could support efficient queries of the solution for arbitrary a. We propose an O(n log² n)-time, O(n)-space algorithm that takes X₀ as input and outputs such a data structure supporting O(log n)-time queries.

Subject Classification

ACM Subject Classification
  • Theory of computation → Pattern matching
  • algorithms
  • sequence of real numbers
  • maximum-sum segment


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Fredrik Bengtsson and Jingsen Chen. Computing maximum-scoring segments optimally. Luleå tekniska universitet, 2007. Google Scholar
  2. Jon Bentley. Programming pearls: algorithm design techniques. Communications of the ACM, 27(9):865-871, 1984. Google Scholar
  3. Kuan-Yu Chen and Kun-Mao Chao. On the range maximum-sum segment query problem. Discrete Applied Mathematics, 155(16):2043-2052, 2007. URL: https://doi.org/10.1016/j.dam.2007.05.018.
  4. Chih-Huai Cheng, Hsiao-Fei Liu, and Kun-Mao Chao. Optimal algorithms for the average-constrained maximum-sum segment problem. Information Processing Letters, 109(3):171-174, 2009. URL: https://doi.org/10.1016/j.ipl.2008.09.024.
  5. Kai-Min Chung and Hsueh-I Lu. An optimal algorithm for the maximum-density segment problem. SIAM Journal on Computing, 34(2):373-387, 2005. URL: https://doi.org/10.1137/S0097539704440430.
  6. Margaret Dayhoff, R Schwartz, and B Orcutt. A model of evolutionary change in proteins. Atlas of protein sequence and structure, 5:345-352, 1978. Google Scholar
  7. Takeshi Fukuda, Yasuhiko Morimoto, Shinichi Morishita, and Takeshi Tokuyama. Data mining with optimized two-dimensional association rules. ACM Transactions on Database Systems (TODS), 26(2):179-213, 2001. URL: https://doi.org/10.1145/383891.383893.
  8. Michael H Goldwasser, Ming-Yang Kao, and Hsueh-I Lu. Fast algorithms for finding maximum-density segments of a sequence with applications to bioinformatics. In Algorithms in Bioinformatics: Second International Workshop, WABI 2002 Rome, Italy, September 17-21, 2002 Proceedings 2, pages 157-171. Springer, 2002. URL: https://doi.org/10.1007/3-540-45784-4_12.
  9. Steven Henikoff and Jorja G Henikoff. Amino acid substitution matrices from protein blocks. Proceedings of the National Academy of Sciences, 89(22):10915-10919, 1992. URL: https://doi.org/10.1073/pnas.89.22.10915.
  10. Sung Kwon Kim. Linear-time algorithm for finding a maximum-density segment of a sequence. Information Processing Letters, 86(6):339-342, 2003. URL: https://doi.org/10.1016/S0020-0190(03)00225-4.
  11. Yaw-Ling Lin, Tao Jiang, and Kun-Mao Chao. Efficient algorithms for locating the length-constrained heaviest segments with applications to biomolecular sequence analysis. Journal of Computer and System Sciences, 65(3):570-586, 2002. URL: https://doi.org/10.1016/S0022-0000(02)00010-7.
  12. Kalyan Perumalla and Narsingh Deo. Parallel algorithms for maximum subsequence and maximum subarray. Parallel Processing Letters, 5(03):367-373, 1995. URL: https://doi.org/10.1142/S0129626495000345.
  13. Walter L Ruzzo and Martin Tompa. A linear time algorithm for finding all maximal scoring subsequences. In ISMB, volume 99, pages 234-241, 1999. URL: http://www.aaai.org/Library/ISMB/1999/ismb99-027.php.
  14. Yoshifumi Sakai. A maximal local maximum-sum segment data structure. IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences, 101(9):1541-1542, 2018. URL: https://doi.org/10.1587/transfun.E101.A.1541.
  15. Nikola Stojanovic, Liliana Florea, Cathy Riemer, Deborah Gumucio, Jerry Slightom, Morris Goodman, Webb Miller, and Ross Hardison. Comparison of five methods for finding conserved sequences in multiple alignments of gene regulatory regions. Nucleic Acids Research, 27(19):3899-3910, 1999. URL: https://doi.org/10.1093/nar/27.19.3899.
  16. Lusheng Wang and Ying Xu. Segid: Identifying interesting segments in (multiple) sequence alignments. Bioinformatics, 19(2):297-298, 2003. URL: https://doi.org/10.1093/bioinformatics/19.2.297.
  17. Hung-I Yu, Tien-Ching Lin, and DT Lee. Finding maximum sum segments in sequences with uncertainty. Theoretical Computer Science, 850:221-235, 2021. URL: https://doi.org/10.1016/j.tcs.2020.11.005.