[Jprogramming] Greatest Increasing Subsequence
'Mike Day' via Programming
programming at jsoftware.com
Fri Sep 2 15:26:08 UTC 2016
Same problem with my version, which was faster but equally wrong!
Mike
On 02/09/2016 14:57, Raul Miller wrote:
> Actually, if we try your approach on -8 2 4 3 1 6 we get _8 _2 _1
> instead of _8 _4 _3 _1.
>
> Here's a brute force O(2^n) approach that I hacked up earlier - it
> obviously only works on short lists:
>
> increasing=: (-: /:~)@#~"1 #:@i.@^~&2@#
> longestinc=: ] #~ [: (#~ ([: (= >./) +/"1)) #:@I. at increasing
>
> We can do better, of course, but I have some other things I want to
> deal with, first.
>
> Thanks,
>
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
More information about the Programming
mailing list