erikpalla
3/5/2017 - 9:54 PM

quickSort.js

function quicksort(list) {
  if (list.length < 2) {
     return list;
  }
 
 const pivot = random(list);
 const less = list.filter(i => i < pivot);
 const greater = list.filter(i => i > pivot);
  
 return [
   ...quicksort(less),
     pivot,
   ...quicksort(greater)
   ];
 }