Efficient algorithms for the sum selection problem and k maximum sums problem

  • Authors:
  • Tien-Ching Lin;D. T. Lee

  • Affiliations:
  • Institute of Information Science, Academia Sinica, Nankang, Taipei 115, Taiwan;Institute of Information Science, Academia Sinica, Nankang, Taipei 115, Taiwan and Department of Computer Science and Information Engineering, National Taiwan University, Taipei, Taiwan

  • Venue:
  • Theoretical Computer Science
  • Year:
  • 2010

Quantified Score

Hi-index 5.23

Visualization

Abstract

Given a sequence of n real numbers A=a"1,a"2,...,a"n and a positive integer k, the Sum Selection Problem is to find the segment A(i^*,j^*)=a"i"^"*,a"i"^"*"+"1,...,a"j"^"* such that the rank of the sum s(i^*,j^*)=@?"t"="i"^"*^j^^^*a"t is k over all n(n-1)2 segments. We present a deterministic algorithm for this problem that runs in O(nlogn) time. The previously best known result for this problem is a randomized algorithm that runs in expected O(nlogn) time. Applying this algorithm we can obtain a deterministic algorithm for the k Maximum Sums Problem, i.e., the problem of enumerating the k largest sum segments, that runs in O(nlogn+k) time. The previously best known randomized and deterministic algorithms for the k Maximum Sums Problem run respectively in expected O(nlogn+k) time and in worst case O(nlog^2n+k) time.