Randomized algorithm for the sum selection problem

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

  • Affiliations:
  • Department of Computer Science and Information Engineering, National Taiwan University, Taipei, Taiwan;Department of Computer Science and Information Engineering, National Taiwan University, Taipei, Taiwan

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

Quantified Score

Hi-index 5.23

Visualization

Abstract

Let A be a sequence of n real numbers a"1,a"2,...,a"n. We consider the Sum Selection Problem as that of finding the segment A(i^*,j^*) such that the rank of s(i^*,j^*)=@?"t"="i"^"*^j^^^*a"t over all possible feasible segments is k, where a feasible segment A(i,j)=a"i,a"i"+"1,...,a"j is a consecutive subsequence of A, and its width j-i+1 satisfies @?@?j-i+1@?u for some given integers @? and u, and @?@?u. It is a generalization of two well-known problems: the Selection Problem in computer science for which @?=u=1, and the Maximum Sum Segment Problem in bioinformatics for which the rank k is the total number of possible feasible segments. We will give a randomized algorithm for the Sum Selection Problem that runs in expected O(nlog(u-@?)) time. It matches the optimal O(n) time randomized algorithm for the Selection Problem. We can also solve the k Maximum Sums Problem, to enumerate the k largest sums, in expected O(nlog(u-@?)+k) time. The previously best known result was an algorithm that solves this problem for the case when @?=1, u=n and runs in O(nlog^2n+k) time in the worst case.