Does anyone know of a clean C/C++ implementation of timsort?
The Python sources contain a description and code for the original timsort, but it is understandably full of python-specific calls.
Thanks!
Does anyone know of a clean C/C++ implementation of timsort?
The Python sources contain a description and code for the original timsort, but it is understandably full of python-specific calls.
Thanks!
is it a timsort you wanted?
And other variant (more likely you wanted this)
It is not complete, but it describe code a lot in post.txt
This implementation from Android isn't in C, but it's way easier to understand than the original that's on Python's SVN.
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/TimSort.java?view=co
Hopefully it's relatively easy to translate to C code.
I wrote a fast, template-like version in C:
http://github.com/swenson/sort
It also includes a bunch of other sorting algorithms. Timsort seems to beat quick sort by 5% or so.