3 ms·
Errata: Should revise "there is a cute counting result from A. Gleason, long a math prof at Harvard, that shows that for sorting by comparing numbers two at a
by graycat 7y ago
Errata: Should revise
"there is a cute counting result from A. Gleason, long a math prof at Harvard, that shows that for sorting by comparing numbers two at a time
O(n log(n) )
is the fastest possible."
by adding at the end "for worst case performance".
Should revise
"Then look at the remaining n - 1 numbers and again find the smallest."
by adding at the end "etc.".
Generally computer science computational complexity ignores long lists of ways to write code that runs faster, e.g., for a result needed more than once, compute it just once and store the result and don't repeat the calculation.
Instead, the emphasis is on some larger aspects, e.g., just counting comparisons. Broadly that emphasis is usually appropriate since as n grows quite soon some crude code of a O( n log(n) ) algorithm will run many times faster than careful code of an O( n^2 ) algorithm.
- graycat 7y agoErrata: adding at the end "for average case performance".