Does anyone know where to find code examples of the original (old) form of bubble sort and the new improved one?
Does anyone know where to find code examples of the original (old) form of bubble sort and the new improved one?
It would be great if you mentioned *which* new improved one you are referring to. Combsort is one of the newer sorts, based on improvements to bubblesort, iirc.
Google for "combsort" or "combsort 11" I believe Wikipedia had a hyperlink to it in their entry on sorting algorithms, as well. Could be wrong on that, though.
Improved one? There are several ways to improve it. E.g. the swapped flag, or even better, the bubble's floated to position. Then there's ShakerSort which is similar to the later but works in both directions making it better still, and of course CombSort. I have them all in C++ on my website.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"