Is shell sort faster than qsort?
Posted on 2003-02-24
The following version of shell sort performed atleast 5 times faster than qsort with 100000 records. How is that possible?
void shellSort(unsigned long numbers, unsigned long array_size)
unsigned long i, j, increment, temp;
increment = array_size /2;
while (increment > 0)
for (i=0; i < array_size; i++)
j = i;
temp = numbers[i];
while ((j >= increment) && (numbers[j-increment] > temp))
numbers[j] = numbers[j - increment];
j = j - increment;
numbers[j] = temp;
increment /= 2;