[comp.graphics] Sorting

rokicki@Neon.Stanford.EDU (Tomas G. Rokicki) (05/05/90)

> Quicksort is is generally quite fast O(n log n), but its worst case
> behavior (a pre-sorted list) is O(n^2).  If your list tends to stay
> sorted, a you might choose other O(n log n) algorithms like heapsort
> or mergesort.

Depends on how you implement quicksort; no good implementation takes
n^2 on a sorted list.  Median of three partitioning works well.

For an excellent simple sort, see Harrison and Steele (I forgot the
page number); it's a line more than bubble sort, but much faster.
(It's just got the Shell sort loop . . .)

-tom