Skip to content

Instantly share code, notes, and snippets.

@Centaur
Created October 25, 2011 14:47
Show Gist options
  • Save Centaur/1312984 to your computer and use it in GitHub Desktop.
Save Centaur/1312984 to your computer and use it in GitHub Desktop.
def quicksort[T : Ordering](l: List[T]) : List[T] = l match {
case Nil => Nil
case x :: xs =>
val ord = Ordering[T]
import ord._
val smaller = quicksort(xs.filter(_<=x))
val bigger = quicksort(xs.filter(_>x))
smaller ++ List(x) ++ bigger
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment