in reply to RE: RE: RE: Shift, Pop, Unshift and Push with Impunity!
in thread Shift, Pop, Unshift and Push with Impunity!
It depends on how qsort is implemented by the C
stdlib library with which perl was compiled. My guess is no,
but it really depends on how your C stdlib was implemented.
It is easy to add a "quicksort worst-case avoider"
by not using a "use the first element as the pivot" and instead
doing something like:
- adding a "sorted list detector"
- Picking the pivot randomly (instead of as the first element)
- Shuffling the list before sorting
- Using another pivot picking technique
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Shift, Pop, Unshift and Push with Impunity!
by jonadab (Parson) on Feb 04, 2004 at 05:56 UTC |
In Section
Meditations