Re: Minimum sub-sequence sum



grpadmin@xxxxxxxxx wrote:
Michael Jarrod wrote:
I have a sequence of integers (positive/negative values) and I would
like to find the sub sequence of consecutive values that yields the
smallest sum, I can think of a very simple O(n^3) complex solution,
however I was wondering are there any better solutions? and what is
the name of this kind of problem?

Jon Bentley uses a problem like this in one of his Programming Pearls
columns. There are
subquadratic algorithms as well as two quadratic algorithms he
considers. You might try a
divide-and-conquer approach and also a tail-recursive (read: clever
iterative) approach to get
a subquadratic runtime. Surprisingly, the quickest solution needs
little memoization if any.

If you can't come up with it on your own (or even if you can), check
out the collections (two
that I know) of Programming Pearls by the above author.

It's in the first collection, /Programming Pearls/. First edition 1986,
second 2000.

http://www.amazon.com/Programming-Pearls-2nd-ACM-Press/dp/0201657880

--
--Bryan

.



Relevant Pages

  • Re: Minimum sub-sequence sum
    ... like to find the sub sequence of consecutive values that yields the ... smallest sum, I can think of a very simple Ocomplex solution, ...
    (sci.math)
  • Re: Minimum sub-sequence sum
    ... like to find the sub sequence of consecutive values that yields the ... smallest sum, I can think of a very simple Ocomplex solution, ...
    (comp.programming)
  • Re: Minimum sub-sequence sum
    ... like to find the sub sequence of consecutive values that yields the ... smallest sum, I can think of a very simple Ocomplex solution, ... Try different positions for the start of the subsequence ... Calculating the sum of a subsequence ...
    (comp.theory)
  • Minimum sub-sequence sum
    ... like to find the sub sequence of consecutive values that yields the ... smallest sum, I can think of a very simple Ocomplex solution, ...
    (comp.programming)
  • Minimum sub-sequence sum
    ... like to find the sub sequence of consecutive values that yields the ... smallest sum, I can think of a very simple Ocomplex solution, ...
    (comp.theory)