Skip to main content

A Linear Time Algorithm for the k Maximal Sums Problem

  • Conference paper
Mathematical Foundations of Computer Science 2007 (MFCS 2007)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 4708))

Abstract

Finding the sub-vector with the largest sum in a sequence of n numbers is known as the maximum sum problem. Finding the k sub-vectors with the largest sums is a natural extension of this, and is known as the k maximal sums problem. In this paper we design an optimal O(n + k) time algorithm for the k maximal sums problem. We use this algorithm to obtain algorithms solving the two-dimensional k maximal sums problem in O(m 2·n + k) time, where the input is an m ×n matrix with m ≤ n. We generalize this algorithm to solve the d-dimensional problem in O(n 2d − 1 + k) time. The space usage of all the algorithms can be reduced to O(n d − 1 + k). This leads to the first algorithm for the k maximal sums problem in one dimension using O(n + k) time and O(k) space.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Bentley, J.: Programming pearls: algorithm design techniques. Commun. ACM 27(9), 865–873 (1984)

    Article  MathSciNet  Google Scholar 

  2. 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)

    Article  MATH  Google Scholar 

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

    Article  Google Scholar 

  4. Gries, D.: A note on a standard strategy for developing loop invariants and loops. Sci. Comput. Program. 2(3), 207–214 (1982)

    Article  MATH  MathSciNet  Google Scholar 

  5. 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, PA, USA (1998)

    Google Scholar 

  6. Takaoka, T.: Efficient algorithms for the maximum subarray problem by distance matrix multiplication. Electr. Notes Theor. Comput. Sci. 61 (2002)

    Google Scholar 

  7. Takaoka, T.: A new upper bound on the complexity of the all pairs shortest path problem. Inf. Process. Lett. 43(4), 195–199 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  8. Bae, S.E., Takaoka, T.: Algorithms for the problem of k maximum sums and a vlsi algorithm for the k maximum subarrays problem. In: 7th International Symposium on Parallel Architectures, Algorithms, and Networks (I-SPAN 2004), Hong Kong, SAR, China, 10-12 May 2004, pp. 247–253. IEEE Computer Society, Los Alamitos (2004)

    Google Scholar 

  9. 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)

    Google Scholar 

  10. Bae, S.E., Takaoka, T.: Improved algorithms for the k-maximum subarray problem for small k. In: Wang, L. (ed.) COCOON 2005. LNCS, vol. 3595, pp. 621–631. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  11. Bae, S.E., Takaoka, T.: Improved algorithms for the k-maximum subarray problem. Comput. J. 49(3), 358–374 (2006)

    Article  Google Scholar 

  12. Lin, T.-C., Lee, D.T.: Randomized algorithm for the sum selection problem. In: Deng, X., Du, D.-Z. (eds.) ISAAC 2005. LNCS, vol. 3827, pp. 515–523. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  13. Cheng, C.-H., Chen, K.-Y., Tien, W.-C., Chao, K.-M.: Improved algorithms for the k maximum-sums problems. Theoretical Computer Science 362(1-3), 162–170 (2006)

    Article  MATH  MathSciNet  Google Scholar 

  14. Chao, K.M., Liu, H.F.: Personal communication (2007)

    Google Scholar 

  15. Eppstein, D.: Finding the k shortest paths. SIAM J. Comput. 28(2), 652–673 (1999)

    Article  MathSciNet  Google Scholar 

  16. Frederickson, G.N.: An optimal algorithm for selection in a min-heap. Inf. Comput. 104(2), 197–214 (1993)

    Article  MATH  MathSciNet  Google Scholar 

  17. 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)

    Article  MATH  MathSciNet  Google Scholar 

  18. Sleator, D.D., Tarjan, R.E.: Self adjusting heaps. SIAM J. Comput. 15(1), 52–69 (1986)

    Article  MATH  MathSciNet  Google Scholar 

  19. Crane, C.A.: Linear lists and priority queues as balanced binary trees. Technical Report STAN-CS-72-259, Dept. of Computer Science, Stanford University (1972)

    Google Scholar 

  20. Knuth, D.E.: The art of computer programming, sorting and searching, 2nd edn., vol. 3. Addison Wesley Longman Publishing Co., Inc., Redwood City, CA, USA (1998)

    Google Scholar 

  21. 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)

    Article  MATH  MathSciNet  Google Scholar 

  22. Williams, J.W.J.: Algorithm 232: Heapsort. Communications of the ACM 7(6), 347–348 (1964)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Luděk Kučera Antonín Kučera

Rights and permissions

Reprints and permissions

Copyright information

© 2007 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Brodal, G.S., Jørgensen, A.G. (2007). A Linear Time Algorithm for the k Maximal Sums Problem. In: Kučera, L., Kučera, A. (eds) Mathematical Foundations of Computer Science 2007. MFCS 2007. Lecture Notes in Computer Science, vol 4708. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-74456-6_40

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-74456-6_40

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-74455-9

  • Online ISBN: 978-3-540-74456-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics