Algorithms 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 a two-dimensional array of size n x n, little study has been undertaken to improve the time complexity. We first propose an O(n + K log K) time solution for one-dimension. This is asymptotically equivalent to Ruzzo and Tompa's when sorted order is needed. Based on this, we achieve O(n(3) + Kn(2) log n) time for two-dimensions. This is cubic time when K   n, namely O(n(3) + min(K, n) center dot n log n).
maximum subarray problem ranking k maximum sums disjoint sets union/find problem