Don't ask to ask, just ask  
PerlMonks 
Re^2: Puzzle: Longest Increasing Sequenceby jdporter (Canon) 
on Apr 16, 2006 at 15:42 UTC ( #543650=note: print w/ replies, xml )  Need Help?? 
The problem is, you could have as many as i (where i = 1 to n) "best candidates" at any time. Consider — if the list looks like this: (i.e. you've processed all but the last number) you won't know until you look at the last number which of the preceding numbers (if any) are in the solution. x could be 10, or it could be 2, for example. So you need to keep all the increasing subsequences seen so far; and that could be as many as n; and that means the algorithm is at least O(n log n).
We're building the house of the future together.
In Section
Seekers of Perl Wisdom

