Timsort vs some others

bearophile bearophileHUGS at lycos.com
Tue Dec 18 18:21:00 PST 2012


Andrei Alexandrescu:

> A very efficient sort for various small fixed sizes is a great 
> complement for quicksort.

Do you mean to use it when the input is very short, or when the 
QuickSort recursion has produced a very small subarray? In the 
first case it's useful, but in the second case I've seen it's 
more efficient (maybe not for huge arrays, but it is more 
efficient for normal arrays in RAM) to not call a specialized 
sort for such small sub-arrays, and instead just stop the 
QuickSort recursion and produce a locally unsorted array, and 
then call an insertion sort on the whole data.

Bye,
bearophile


More information about the Digitalmars-d mailing list