Efficient Algorithms for the Sum Selection Problem and K Maximum Sums Problem

* Final gross prices may vary according to local VAT.

Get Access

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 \(\frac{n(n-1)}{2}\) segments. We present a deterministic algorithm for this problem that runs in O(n logn) time. The previously best known randomized algorithm for this problem runs in expected O(n logn) 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(n logn + k) time. The previously best known randomized and deterministic algorithms for the k Maximum Sums Problem run respectively in expected O(n logn + k) and O(n log2 n + k) time in the worst case.