Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
exec scala "$0" "$@"
def quicksort(l: List[Int]): List[Int] = l match {
case Nil => Nil
case p :: xs =>
val (l1, l2) = xs.partition(_ < p)
quicksort(l1) ::: p :: quicksort(l2)
println(quicksort(List(10,5,999,42,3,1)).mkString(" "))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment