Skip to content

Instantly share code, notes, and snippets.

@notyy
Created April 27, 2012 06:31
Show Gist options
  • Save notyy/2506584 to your computer and use it in GitHub Desktop.
Save notyy/2506584 to your computer and use it in GitHub Desktop.
quicksort in scala
def qs[T <% Ordered[T]](l: List[T]): List[T] = l match {
case Nil => Nil
case (x :: xs) => {
val (less,greater) = xs partition (_ <= x)
qs(less) ++ (x :: qs(greater))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment