[Jprogramming] maximum sub-sequence

Raul Miller rauldmiller at gmail.com
Fri Dec 28 00:18:56 HKT 2007


On 12/27/07, Mike Day <mike_liz.day at tiscali.co.uk> wrote:
> You actually want to recover the subsequence, and Raul's mss looks
> good, though surprisingly seems to go astray on this example, which
> I'll point out without trying to find out why as my wife wants me to help
> with tidying up now the children have gone -

Good catch!

My routine finds the sequence which contains the maximum
subsequence, but does not necessarily terminate that
subsequence soon enough.

To fix this problem, use ({.~1+[:(i.>./)+/\) on the result of
my mss.

-- 
Raul


More information about the Programming mailing list