Randomized Algorithm for the Sum Selection 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) = \sum_{t = i}^{j}{a_{t}}\) is k over all \({n(n-1)} \over {2}\) segments. We will give a randomized algorithm for this problem that runs in expected O(n log n) time. Applying this algorithm we can obtain an algorithm for the k Maximum Sums Problem, i.e., the problem of enumerating the k largest sum segments, that runs in expected O(n log n + k) time. The previously best known algorithm for the k Maximum Sums Problem runs in O(n log2 n + k) time in the worst case.