P is for Practical | |
PerlMonks |
Re^2: Puzzle: Longest Increasing Sequenceby Anonymous Monk |
on Nov 06, 2011 at 02:28 UTC ( [id://936219]=note: print w/replies, xml ) | Need Help?? |
This algorithm will not give us a O(nlogn) running time, because you are copying one of the subsequences on each step. So, it will give you O(n^2). To have O(nlogn) you should do binary search through the last elements of each subsequence and insert it respectively...
In Section
Seekers of Perl Wisdom
|
|