Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Bitten by the worst case (or why it pays to know whats inside the black box)by Zaxo (Archbishop) |
on Jun 26, 2004 at 16:10 UTC ( [id://369839]=note: print w/replies, xml ) | Need Help?? |
its not clear to me if this is still true in 5.8 Perl 5.8 defaults to mergesort on most platforms, though quicksort is still available through use sort '_quicksort';. The mergesort algorithm does not have the nasty worst case performance which bit demerphq. It guarantees to run in O(NlogN) time. It is also stable, meaning that items which compare equal in the sort retain their order in the result. Its disadvantage is that it uses O(N) memory for temporary storage. After Compline,
In Section
Meditations
|
|