Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Cocktail Sort 2—New and Improved

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
4,718
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Nov 9, 2008

Made using the javascript canvas element.

Category:

Science & Technology

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (3)

Sign In or Sign Up now to post a comment!
  • @SilkSwe So it just picks an element, check it against all unsorted elements and then swaps things around? makes sense :)

  • @Pureferret That's no problem. This is just bubblesort going both ways. It starts by taking the first non-sorted element and as it progresses it checks to see if it can find a element that's bigger than the reference. If it does it switches to use the new largest element as reference. Once it reaches the end it has found the next element and therefore marks it as sorted. Going back is the same thing except it tries to find the smallest non-sorted element.

  • Hows does it work when the elements aren't evenly spaced, i.e. with gaps?

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more