3 ms·
The following algorithm does not need any mutations: quicksort (list) if null(list) or else length(list) <= 1 return list else
by waynecochran 8y ago
The following algorithm does not need any mutations:
quicksort (list)
if null(list) or else length(list) <= 1
return list
else
p = findpivot(list)
(lo, hi) = split(p, list)
return concat(quicksort(lo), quicksort(hi))
I still call it quicksort.