in reply to Bitten by the worst case (or why it pays to know whats inside the black box)
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,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bitten by the worst case (or why it pays to know whats inside the black box)
by Fletch (Bishop) on Jun 27, 2004 at 00:38 UTC | |
by BrowserUk (Patriarch) on Jun 27, 2004 at 01:04 UTC |