Skip to content

Instantly share code, notes, and snippets.

@maruks
Created December 29, 2015 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maruks/a4955274d54bbddaa358 to your computer and use it in GitHub Desktop.
Save maruks/a4955274d54bbddaa358 to your computer and use it in GitHub Desktop.
quick sort
qsort([]) ->
[];
qsort([H | T]) ->
L = [E || E <- T, E < H],
R = [E || E <- T, E > H],
P = [E || E <- T, E =:= H],
qsort(L) ++ [H | P] ++ qsort(R).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment