old and new bubblesort?

This is a discussion on old and new bubblesort? within the C Programming forums, part of the General Programming Boards category; Does anyone know where to find code examples of the original (old) form of bubble sort and the new improved ...

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    15

    old and new bubblesort?

    Does anyone know where to find code examples of the original (old) form of bubble sort and the new improved one?

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    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.

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,304
    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"

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21