mistadikay
3/30/2015 - 6:43 AM

selectionsort.js

var selectionSort = function (a) {
  for (let i = -1; ++i < a.length;) {
    for (let m = j = i; ++j < a.length;) {
      if (a[m] > a[j]) m = j;
    }
    a[m], a[i] = a[i], a[m];
 }
 return a;
}