Created
September 26, 2014 17:23
-
-
Save apotheon/87808f70613a0fbc76e4 to your computer and use it in GitHub Desktop.
Erlang Quicksort
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| quicksort( [] ) -> []. | |
| quicksort( [FirstElement | RestOfList] ) -> | |
| SmallerThan = fun(X) -> X < FirstElement end, | |
| { Smaller, LargerOrEq } = lists:partition(SmallerThan, RestOfList), | |
| quicksort(Smaller) ++ [FirstElement] ++ quicksort(Larger). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment