Skip to content

Instantly share code, notes, and snippets.

@jost125
Last active December 14, 2015 01:19
Show Gist options
  • Save jost125/5005625 to your computer and use it in GitHub Desktop.
Save jost125/5005625 to your computer and use it in GitHub Desktop.
class QuickSorter[T <% Ordered[T]] {
def sort(list: List[T]) : List[T] = {
list match {
case Nil => Nil
case pivot :: rest =>
val (smaller, higher) = rest.partition(_ < pivot)
sort(smaller) ++ (pivot :: sort(higher))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment