Re: efficient partial sort in Python ?

2014-08-19 Thread Chiu Hsiang Hsu
On Tuesday, August 19, 2014 5:42:27 AM UTC+8, Dan Stromberg wrote: > On Mon, Aug 18, 2014 at 10:18 AM, Chiu Hsiang Hsu wrote: > > > I know that Python use Timsort as default sorting algorithm and it is > > efficient, > > > but I just wanna have a partial sorting (

efficient partial sort in Python ?

2014-08-18 Thread Chiu Hsiang Hsu
I know that Python use Timsort as default sorting algorithm and it is efficient, but I just wanna have a partial sorting (n-largest/smallest elements). In the current state, I can only find this kind of functions from heapq, but it's too slow for this problem, the pure c sorted function can easily