Selecting Sums in Arrays

  • Gerth Stølting Brodal
  • Allan Grønlund Jørgensen
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5369)


In an array of n numbers each of the \(\binom{n}{2}+n\) contiguous subarrays define a sum. In this paper we focus on algorithms for selecting and reporting maximal sums from an array of numbers. First, we consider the problem of reporting k subarrays inducing the k largest sums among all subarrays of length at least l and at most u. For this problem we design an optimal O(n + k) time algorithm. Secondly, we consider the problem of selecting a subarray storing the k’th largest sum. For this problem we prove a time bound of Θ(n · max {1,log(k/n)}) by describing an algorithm with this running time and by proving a matching lower bound. Finally, we combine the ideas and obtain an O(n· max {1,log(k/n)}) time algorithm that selects a subarray storing the k’th largest sum among all subarrays of length at least l and at most u.


Time Algorithm Additive Constant Large Element Linear Time Algorithm Input Array 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Allison, L.: Longest biased interval and longest non-negative sum interval. Bioinformatics 19(10), 1294–1295 (2003)CrossRefGoogle Scholar
  2. 2.
    Altschul, S.F., Gish, W., Miller, W., Myers, E.W., Lipman, D.J.: Basic local alignment search tool. Journal of Molecular Biology 215(3), 403–410 (1990)CrossRefGoogle Scholar
  3. 3.
    Arge, L., Vitter, J.S.: Optimal external memory interval management. SIAM Journal on Computing 32(6), 1488–1508 (2003)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Bae, S.E., Takaoka, T.: Algorithms for the problem of k maximum sums and a vlsi algorithm for the k maximum subarrays problem. In: Proc. 7th International Symposium on Parallel Architectures, Algorithms, and Networks, pp. 247–253. IEEE Computer Society, Los Alamitos (2004)Google Scholar
  5. 5.
    Bentley, J.: Programming pearls: algorithm design techniques. Commun. ACM 27(9), 865–873 (1984)CrossRefGoogle Scholar
  6. 6.
    Blum, M., Floyd, R.W., Pratt, V.R., Rivest, R.L., Tarjan, R.E.: Time bounds for selection. J. Comput. Syst. Sci. 7(4), 448–461 (1973)MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Brodal, G.S., Jørgensen, A.G.: A linear time algorithm for the k maximal sums problem. In: Kučera, L., Kučera, A. (eds.) MFCS 2007. LNCS, vol. 4708, pp. 442–453. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  8. 8.
    Driscoll, J.R., Sarnak, N., Sleator, D.D., Tarjan, R.E.: Making data structures persistent. Journal of Computer and System Sciences 38(1), 86–124 (1989)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    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: Proc. 8th International Conference on Implementation and Application of Automata. LNCS, pp. 46–66. Springer, Heidelberg (2003)Google Scholar
  10. 10.
    Frederickson, G.N.: An optimal algorithm for selection in a min-heap. Inf. Comput. 104(2), 197–214 (1993)MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Frederickson, G.N., Johnson, D.B.: The complexity of selection and ranking in X+Y and matrices with sorted columns. J. Comput. Syst. Sci. 24(2), 197–208 (1982)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Fukuda, T., Morimoto, Y., Morishita, S., Tokuyama, T.: Data mining with optimized two-dimensional association rules. ACM Trans. Database Syst. 26(2), 179–213 (2001)CrossRefzbMATHGoogle Scholar
  13. 13.
    Fukuda, T., Morimoto, Y., Morishta, S., Tokuyama, T.: Interval finding and its application to data mining. IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences E80-A(4), 620–626 (1997)Google Scholar
  14. 14.
    Hannenhalli, S., Levy, S.: Promoter prediction in the human genome. Bioinformatics 17, S90–S96 (2001)CrossRefGoogle Scholar
  15. 15.
    Huang, X.: An algorithm for identifying regions of a DNA sequence that satisfy a content requirement. Computer Applications in the Biosciences 10(3), 219–225 (1994)Google Scholar
  16. 16.
    Lin, T.-C., Lee, D.T.: Efficient algorithms for the sum selection problem and k maximum sums problem. In: The 17th International Symposium on Algorithms and Computation. LNCS, pp. 460–473. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  17. 17.
    Lin, T.-C., Lee, D.T.: Randomized algorithm for the sum selection problem. Theor. Comput. Sci. 377(1-3), 151–156 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Lin, Y.-L., Jiang, T., Chao, K.-M.: Efficient algorithms for locating the length-constrained heaviest segments, with applications to biomolecular sequence analysis. In: Proc. 27th International Symposium of Mathematical Foundations of Computer Science 2002. LNCS, pp. 459–470. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  19. 19.
    Nievergelt, J., Reingold, E.M.: Binary search trees of bounded balance. In: STOC 1972: Proceedings of the fourth annual ACM symposium on Theory of computing, pp. 137–142. ACM, New York (1972)CrossRefGoogle Scholar
  20. 20.
    Okasaki, C.: Purely functional random-access lists. In: Functional Programming Languages and Computer Architecture, pp. 86–95 (1995)Google Scholar
  21. 21.
    Takaoka, T.: Efficient algorithms for the maximum subarray problem by distance matrix multiplication. Electr. Notes Theor. Comput. Sci. 61 (2002)Google Scholar
  22. 22.
    Tamaki, H., 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. Society for Industrial and Applied Mathematics, Philadelphia (1998)Google Scholar
  23. 23.
    Walder, R.Y., Garrett, M.R., McClain, A.M., Beck, G.E., Brennan, T.M., Kramer, N.A., Kanis, A.B., Mark, A.L., Rapp, J.P., Sheffield, V.C.: Short tandem repeat polymorphic markers for the rat genome from marker-selected libraries. Mammalian Genome 9(12), 1013–1021 (1998)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Gerth Stølting Brodal
    • 1
  • Allan Grønlund Jørgensen
    • 1
  1. 1.BRICS, MADALGO, Department of Computer ScienceUniversity of AarhusDenmark

Personalised recommendations