Hi David,
You wrote to Herman Schonfeld:
DN>DN>I think teachers should teach insertion sort first, as it is simpler to
DN>DN>code
DN>DN>than bubble sort, as well as being faster. [I posted some sample code
n
DN>DN>this echo a couple of days ago.]
Interestingly Professor Knuth does cover insertion sort (Shellsort)
before exchange sorts (Bubble sort).
DN>HS>Are you sure? Last time I checked bubble sort was slightly faster.
DN>Yes, I am sure, Professor Sedgewick is sure ("Algorithms", Robert
Sedgewick,
DN>ISBN 0-201-06673-4, page 103) and Professor Knuth is sure (I don't have
DN>Volume III handy, I'm afraid).
Knuth is sure, Vol 3, ISBN 0-201-03803-X page 111, where he also says:
"In short, the bubble sort seems to have nothing to recommend it, except
a catchy name and the fact it leads to some interesting theoretical
problems."
George
* SLMR 2.1a * Wastebasket: Something to throw things near.
--- Maximus/2 3.01
---------------
* Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4)
|