Regarding implementing a stable sort for Phobos

deadalnix deadalnix at gmail.com
Tue Mar 13 09:06:49 PDT 2012


Le 13/03/2012 16:08, Xinok a écrit :
> On Tuesday, 13 March 2012 at 09:32:49 UTC, deadalnix wrote:
>> Le 13/03/2012 10:19, Xinok a écrit :
>>> Would you mind sharing your smoothsort? I haven't implemented one myself
>>> and I'd love to test it out.
>>
>> It is on github :
>> https://github.com/deadalnix/Dsort/blob/master/sort/smooth.d
>
> Thanks. I found a couple cases where it performs better, but overall,
> the overhead of the algorithm seems to be too much and most other
> algorithms performed better.
>
> While some need to be rewritten, I have a slew of algorithms if you want
> them for your project.

smooth sort is intended to be used on semi sorted data (like transparent 
polygons on a 3D scene). Ideal to keep some data sorted.

It also have a guarantee to run in O(n*log(n)). But qsort variation 
(like we have in phobos) is faster in the general case.


More information about the Digitalmars-d mailing list