Algorithm for K Disjoint Maximum Subarrays
The maximum subarray problem is to find the array portion that maximizes the sum of array elements in it. For K disjoint maximum subarrays, Ruzzo and Tompa gave an O(n) time solution for one-dimension. This solution is, however, difficult to extend to two-dimensions. While a trivial solution of O(Kn 3) time is easily obtainable for two-dimensions, little study has been undertaken to better this. We first propose an O(n+Klog K) time solution for one-dimension. This is equivalent to Ruzzo and Tompa’s when order is considered. Based on this, we achieve O(n 3+Kn 2log n) time for two-dimensions. This is cubic time when K≤ n/log n.
KeywordsTrivial Solution Time Solution Array Element Input Array Small Physical Size
- 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: ISPAN 2004, Hong Kong, May 10-12, pp. 247–253. IEEE Comp.Soc. Press, Los Alamitos (2004)Google Scholar
- 4.Bengtsson, F., Chen, J.: A note on ranking k maximum sums. research report 2005:08 (2005) Luleå University of TechnologyGoogle Scholar
- 8.Ruzzo, W.L., Tompa, M.: A linear time algorithm for finding all maximal scoring subsequences. In: ISMB 1999, Heidelberg, Germany, August 6-10, pp. 234–241 (1999)Google Scholar
- 9.Takaoka, T.: Efficient algorithms for the maximum subarray problem by distance matrix multiplication. Elec. Notes in Theoretical Comp. Sci, vol. 61. Elsevier, Amsterdam (2002)Google Scholar
- 10.Tamaki, H., Tokuyama, T.: Algorithms for the maximum subarray problem based on matrix multiplication. In: SODA 1998, San Francisco, January 25-27, pp. 446–452 (1998)Google Scholar