Created
May 5, 2017 16:56
-
-
Save craigp/e7902635ffbb3ad58a99986e70f871af to your computer and use it in GitHub Desktop.
This file contains 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
defmodule Quicksort do | |
def sort([]), do: [] | |
def sort([head|tail]) do | |
{low, high} = Enum.partition(tail, &(&1 < head)) | |
sort(low) ++ [head] ++ sort(high) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment