laziness, impatience, and hubris | |
PerlMonks |
Re^4: Patience Sorting To Find Longest Increasing Subsequenceby Limbic~Region (Chancellor) |
on May 06, 2006 at 14:11 UTC ( [id://547823]=note: print w/replies, xml ) | Need Help?? |
demerphq,
I had taken bart's word for the merge sort in the CB. I later told him the math was wrong (in the CB) but didn't change it because I knew the math was also wrong for his desired method of finishing the sorting. The thing neither of us considered is that the problem space decreases with each pass. In any case, regardless of the accuracy of the math - the merge sort is still the most efficient given the data structure.
Actually the paper by Bespamyatnikh & Segal contains a proof that you can do it in O(N log log N) time.
As far as the binary search is concerned - I have provided implementations to get to the partial sort using both methods so Benchmarking shouldn't be hard. Additionally, implementing a binary search & splice approach to bench against the merge sort is also straight forward. Cheers - L~R
In Section
Meditations
|
|