GNOME-SORT.JS


comparisons:
swaps:



Gnome sort, originally called stupid sort, works by keeping and expanding on a sorted beginning of the array. Every time it finds a pair of elements in the wrong order, it bubbles the light one towards the beginning until it's in the right place.

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