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 ( n log ( 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 ( n log ( 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 ( n log 2 n + k ) time in the worst case.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.