Anonymous user
Sorting algorithms/Cocktail sort with shifting bounds: Difference between revisions
Sorting algorithms/Cocktail sort with shifting bounds (view source)
Revision as of 11:22, 9 May 2020
, 4 years agoadded whitespace.
m (added whitespace.) |
m (added whitespace.) |
||
Line 26:
The improvement is basically that values "bubble" both directions through the
array, because on each iteration the cocktail sort ''bubble sorts'' once
forwards and once backwards.
After ''ii'' passes, the first ''ii'' and the
last ''ii'' elements in the array are in their correct
positions, and don't to be checked (again).
|