OPTIMIZED-GNOME-SORT.JS


comparisons:
swaps:



This optimization works by keeping track of the size of the already sorted portion of the array. When an element is floated up completely, the algorithm goes back to the place in the array where it found it.

sort.js
bubble-sort.js optimized-bubble-sort.js selection-sort.js
cocktail-sort.js optimized-cocktail-sort.js
odd-even-sort.js comb-sort.js quick-sort.js
gnome-sort.js optimized-gnome-sort.js
compare sort algorithms