Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#!/bin/sh
exec scala "$0" "$@"
!#
def quicksort(l: List[Int]): List[Int] = {
l match {
case Nil => Nil
case List(a, _*) => { val (l1, l2) = l.tail.partition(_ < a); quicksort(l1) ::: a :: quicksort(l2) }
}
}
println(quicksort(List(10, 6, 9, 3, 5, 11, 20, 2)).mkString(" "))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.