In a message dated 04-12-98, George White said to Carey Bloodworth about
Bubble And Squeak Sortin
Hi George,
[snip]
CB>compare, etc. all play a major roll in small data sets. When the cost
CB>of exchanging is much larger than doing the comparison (like with a
CB>struct, etc.) it can often be worth doing a few more comparisons to
CB>reduce the number of exchanges you have to do.
GW>Seconded... (or thirded if David gets here first!)
You beat me George.
This is what I obliquely referred to in my message to John Gardeniers when I
said that Selection sort was _sometimes_ faster than Insertion sort.
The classic case is sorting structures where the comparison key is something
simple, like an int, and the amount of data to be exchanged is substantial.
The extra comparisons are cheap when they eliminate poorly chosen exchanges,
and an overall saving is netted.
Regards
Dave
___
* MR/2 2.25 #353 * Windows NT: No Thanks... Not Trusted... Not Today... Not
Tomorrow
--- Maximus/2 3.01
---------------
* Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4)
|