use algorithmatic.com's in-browser integrated-development-environment here. The IDE offers syntax-highlighting, realtime validation, syntax-autocompletion, autocompletion for external-calls, interpreter and basic debugging.
Account
signin
algorithmatic.com uses OpenID - that means you don't need to register, probably you already have an OpenID, you just need to enable it. Click here to sign in
you may want to have a look at higher ranked versions of the current algorithm from the drop-down list below
Version 1
Version 1by creker
+1
Coctail sort is a variation of bubble sort that is both a stable sorting algorithm and a comparison sort. The algorithm differs from bubble sort in that it sorts in both directions on each pass through the list. This sorting algorithm is only marginally more difficult to implement than bubble sort, and solves the problem with so-called turtles in bubble sort.
Worst case performance O(n²)
Best case performance O(n)
Average case performance O(n²)