Skip to content

Instantly share code, notes, and snippets.

@apotheon
Created September 26, 2014 17:22
Show Gist options
  • Select an option

  • Save apotheon/887edb6c7120c70d4f9e to your computer and use it in GitHub Desktop.

Select an option

Save apotheon/887edb6c7120c70d4f9e to your computer and use it in GitHub Desktop.
Elixr Quicksort
defmodule Quicksort do
def qsort([]) do
[]
end
def qsort([pivot | tail]) do
qsort( lc x inlist tail, x < pivot, do: x ) ++ [pivot] ++ qsort( lc x inlist tail,x >= pivot, do: x )
end
end
IO.puts inspect(Quicksort.qsort([10,9,1,3,5,6,4,2,8,7]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment