Improved Algorithms for the k Maximum-Sums Problems

  • Chih-Huai Cheng
  • Kuan-Yu Chen
  • Wen-Chin Tien
  • Kun-Mao Chao
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3827)


Given a sequence of n real numbers and an integer k, \(1 \leq k \leq {1 \over 2}n(n - 1)\), the k maximum-sum segments problem is to locate the k segments whose sums are the k largest among all possible segment sums. Recently, Bengtsson and Chen gave an \(O({\rm min}\{k+n{\rm log}^{2}n,n\sqrt{k}\})\)-time algorithm for this problem. In this paper, we propose an O(n + k log(min{n, k}))-time algorithm for the same problem which is superior to Bengtsson and Chen’s when k is o(nlog n). We also give the first optimal algorithm for delivering the k maximum-sum segments in non-decreasing order if kn. Then we develop an O(n2d − 1 + k logmin{n, k})–time algorithm for the d-dimensional version of the problem, where d>1 and each dimension, without loss of generality, is of the same size n. This improves the best previously known O(n2d − 1C)-time algorithm, also by Bengtsson and Chen, where \(C = {\rm min}\{k + n {\rm log}^{2} n, n{\sqrt{k}}\}\). It should be pointed out that, given a two-dimensional array of size m × n, our algorithm for finding the k maximum-sum subarrays is the first one achieving cubic time provided that k is \(O({{m^{2}n} \over {{\rm log} n }})\).


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bae, S.E., Takaoka, T.: Algorithms for the Problem of k Maximum Sums and a VLSI Algorithm for the k Maximum Subarrays Problem. In: Proceedings of the 7th International Symposium on Parallel Architectures, Algorithms and Networks, pp. 247–253 (2004)Google Scholar
  2. 2.
    Bengtsson, F., Chen, J.: Efficient Algorithms for k Maximum Sums. In: Fleischer, R., Trippen, G. (eds.) ISAAC 2004. LNCS, vol. 3341, pp. 137–148. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  3. 3.
    Bentley, J.: Programming Pearls: Algorithm Design Techniques. Communications of the ACM, 865–871 (1984)Google Scholar
  4. 4.
    Chen, K.-Y., Chao, K.-M.: On the Range Maximum-Sum Segment Query Problem. In: Fleischer, R., Trippen, G. (eds.) ISAAC 2004. LNCS, vol. 3341, pp. 294–305. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  5. 5.
    Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 2nd edn., pp. 185–196. The MIT Press, Cambridge (1999)Google Scholar
  6. 6.
    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. In: Ibarra, O.H., Dang, Z. (eds.) CIAA 2003. LNCS, vol. 2759, pp. 251–257. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  7. 7.
    Fukuda, T., Morimoto, Y., Morishita, S., Tokuyama, T.: Data Mining Using Two-Dimensional Optimized Association Rules: Scheme, Algorithms, and Visualization. In: Proceedings of the 1996 ACM SIGMOD International Conference on Management of Data, pp. 13–23 (1996)Google Scholar
  8. 8.
    Grenander, U.: Pattern Analysis. Springer, Heidelberg (1978)MATHGoogle Scholar
  9. 9.
    Huang, X.: An Algorithm for Identifying Regions of a DNA Sequence that Satisfy a Content Requirement. Computer Applications in the Biosciences 10, 219–225 (1994)Google Scholar
  10. 10.
    Lin, Y.-L., Huang, X., Jiang, T., Chao, K.-M.: MAVG: Locating Non-Overlapping Maximum Average Segments in a Given Sequence. Bioinformatics 19, 151–152 (2003)CrossRefGoogle Scholar
  11. 11.
    Lin, Y.-L., Jiang, T., Chao, K.-M.: Efficient Algorithms for Locating the Length-constrained Heaviest Segments with Applications to Biomolecular Sequence Analysis. Journal of Computer and System Sciences 65, 570–586 (2002)MATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Ruzzo, W.L., Tompa, M.: A Linear Time Algorithm for Finding All Maximal Scoring Subsequences. In: Proceedings of the 7th International Conference on Intelligent Systems for Molecular Biology, pp. 234–241 (1999)Google Scholar
  13. 13.
    Takaoka, T.: Efficient Algorithms for the Maximum Subarray Problem by Distance Matrix Multiplication. Electronic Notes in Theoretical Computer Science 61, 1–10 (2002)CrossRefGoogle Scholar
  14. 14.
    Tamaki, T., Tokuyama, T.: Algorithms for the Maximum Subarray Problem Based on Matrix Multiplication. In: Proceedings of the Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 446–452 (1998)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Chih-Huai Cheng
    • 1
  • Kuan-Yu Chen
    • 1
  • Wen-Chin Tien
    • 1
  • Kun-Mao Chao
    • 1
    • 2
  1. 1.Department of Computer Science and Information Engineering 
  2. 2.Graduate Institute of Networking and MultimediaNational Taiwan UniversityTaipeiTaiwan

Personalised recommendations