2 ms·
Nearly identical implementation in Erlang: qsort([]) -> []; qsort([Pivot|Rest]) -> qsort([ X || X <- Rest, X < Pivot]) ++ [Pivot] ++ qsort([
by kobs 18y ago
Nearly identical implementation in Erlang:
qsort([]) -> [];
qsort([Pivot|Rest]) ->
qsort([ X || X <- Rest, X < Pivot])
++ [Pivot] ++
qsort([ X || X <- Rest, X >= Pivot]).
More: http://en.literateprograms.org/Category:Quicksort http://en.literateprograms.org/Category:Quicksort