Ranking k maximum sums

  • Authors:
  • Fredrik Bengtsson;Jingsen Chen

  • Affiliations:
  • Department of Computer Science and Electrical Engineering, Luleå University of Technology, S-971 87 Luleå, Sweden;Department of Computer Science and Electrical Engineering, Luleå University of Technology, S-971 87 Luleå, Sweden

  • Venue:
  • Theoretical Computer Science
  • Year:
  • 2007

Quantified Score

Hi-index 5.23

Visualization

Abstract

Given a sequence of n real numbers and an integer parameter k, the problem studied in this paper is to compute k subsequences of consecutive elements with the sums of their elements being the largest, the second largest, ..., and the kth largest among all possible range sums of the input sequence. For any value of k, 1@?k@?n(n+1)/2, we design a fast algorithm that takes O(n+klogn) time in the worst case to compute and rank all such subsequences. We also prove that our algorithm is optimal for k=O(n) by providing a matching lower bound. Moreover, our algorithm is an improvement over the previous results on the maximum sum subsequences problem (where only the subsequences are requested and no ordering with respect to their relative sums will be determined). Furthermore, given the fact that we have computed the @?th largest sums, our algorithm retrieves the (@?+1)th largest sum in O(logn) time, after O(n) time of preprocessing.