Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

The Best Sorting Algorithm

Name: Anonymous 2009-09-07 21:49

In this thread we will discuss sorting algorithms and vote for our favorite one.

I will update the stats every postIndex % 25 posts.  

May the best #sort win!

- Bubble Sort
- Insertion Sort
- Selection Sort
- Merge Sort
- Quick Sort
- Heap Sort
- Shell Sort
- Bucket Sort
- Radix Sort


Vote for one of these or any sort you like. I'll add new sorts to the list when I update stats.

Name: Anonymous 2010-05-10 3:48

I'd be interested in seeing how a decent Radix Sort compares to a decent Quicksort in general though, Radix Sort by definition needs more memory, but perhaps little more than twice as much if done right, and in terms of time I can see it winning in a lot of cases.
here's a radix sort for you:
void sort(uintmax_t *numbers, size_t length)
{ for(uintmax_t temp[length], *arrays[2] = {numbers, temp}, start = 0, end = length - 1, i = 0; i < sizeof(uintmax_t) * CHAR_BIT * length; ++i)
  { start = i % length ? start : 0; end = i % length ? end : length - 1;
    arrays[i / length & 1 ^ 1][arrays[i / length & 1][i % length] & 1 << i / length ? end-- : start++] = arrays[i / length & 1][i % length]; }}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List