Chapter

Algorithms and Computation

Volume 3827 of the series Lecture Notes in Computer Science pp 515-523

Randomized Algorithm for the Sum Selection Problem

  • Tien-Ching LinAffiliated withDepartment of Computer Science and Information Engineering, National Taiwan University
  • , D. T. LeeAffiliated withDepartment of Computer Science and Information Engineering, National Taiwan University

* 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.

Keywords

computational geometry randomized algorithm random sampling order-statistic tree k maximum sums problem sum selection problem maximum sum problem maximum sum subarray problem