in reply to Re^7: Longest Increasing Subset
in thread Longest Increasing Subset

I also implemented the wiki pseudo-code, resulting almost identical code:

Though I pass the data in via a reference for efficiency.

I've been trying to wrap my brain around the mentioned Knuth optimisation without success.

One comment on your code. This return wantarray ? @S : [@S]; throws away the advantage of returning a reference, by constructing a list from the existing array, which is then used to construct another (anonymous) array, a reference to which is returned.

Better to just do return wantarray ? @S : \@S;


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.