CS 228 meeting -*- Outline -*-
* summary of sorting
** summary
------------------------------------------
SORTING SUMMARY
Average
Techniques Time cost
A. bubble O(N^2)
B. selection O(N^2)
C. quicksort O(N log N)
Benchmark Bubble Selection Quicksort
1000 random 127.4 80.86 2.52
Key insight:
Divide and conquer
------------------------------------------
** radix sort (HR 12.10) (omit)
applicable to data that have lexicographic structure (like numbers)
and when don't need to sort in place,
because use extra data
(If you can't examine the structure of the sort key in that way,
then O(N log N) is the best one can do.)
O(N) time
in general, slower than quicksort, except for really large data
because of larger overhead