in reply to Re: Re: Re: Re: Re: sorting a vec
in thread sorting a vec
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Re: Re: sorting a vec
by BrowserUk (Patriarch) on Mar 28, 2004 at 04:37 UTC | |
If you just want to use the quicksort algorithm on a standard perl array, then prior to (I think) 5.8.0, perl's built-in sort used that algorithm. From 5.8.0 on, you have to request the quicksort algorithm be used in preference to the now default mergesort using the sort pragma
In the case of the post to which you refer, the OP was looking to save space by storing integers in a packed (or veced) scalar. As the built-in sort doesn't know how to deal with these, it becomes necessary to implement the qsort algorithm yourself. This is the code I knocked up back then to test the performance of a pure perl implementation using vec.
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham"Think for yourself!" - Abigail | [reply] [d/l] [select] |