[SciPy-User] get best few of many: argsort( few= ) using std::partial_sort ?
Charles R Harris
Fri Jul 9 10:46:37 CDT 2010
On Fri, Jul 9, 2010 at 8:33 AM, denis <email@example.com> wrote:
> you've probably seen http://www.sgi.com/tech/stl/partial_sort.html
> sort uses the introsort algorithm and partial_sort uses heapsort
> introsort is usually faster by a factor of 2 to 5
Sounds like partial_sort just sets up the heap and then pulls off the needed
elements. That would make it about twice as fast as the normal heapsort for
a small number of values, or about the same as a full quicksort.
> Heapsort fans: the normal pivot selector (without medians) is blind;
> trying for a pivot near a small k/n percentile is fun.
You mean quicksort?
> Any comments on argsort( few= ) vs a separate partial_sort() ?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User