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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Bentley, J.: Programming pearls: algorithm design techniques. Commun. ACM 27(9), 865–873 (1984)
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)
Allison, L.: Longest biased interval and longest non-negative sum interval. Bioinformatics 19(10), 1294–1295 (2003)
Gries, D.: A note on a standard strategy for developing loop invariants and loops. Sci. Comput. Program. 2(3), 207–214 (1982)
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)
Takaoka, T.: Efficient algorithms for the maximum subarray problem by distance matrix multiplication. Electr. Notes Theor. Comput. Sci. 61 (2002)
Takaoka, T.: A new upper bound on the complexity of the all pairs shortest path problem. Inf. Process. Lett. 43(4), 195–199 (1992)
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)
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)
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)
Bae, S.E., Takaoka, T.: Improved algorithms for the k-maximum subarray problem. Comput. J. 49(3), 358–374 (2006)
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)
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)
Chao, K.M., Liu, H.F.: Personal communication (2007)
Eppstein, D.: Finding the k shortest paths. SIAM J. Comput. 28(2), 652–673 (1999)
Frederickson, G.N.: An optimal algorithm for selection in a min-heap. Inf. Comput. 104(2), 197–214 (1993)
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)
Sleator, D.D., Tarjan, R.E.: Self adjusting heaps. SIAM J. Comput. 15(1), 52–69 (1986)
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)
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)
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)
Williams, J.W.J.: Algorithm 232: Heapsort. Communications of the ACM 7(6), 347–348 (1964)
Author information
Authors and Affiliations
Editor information
Rights 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)