Skip to content

Instantly share code, notes, and snippets.

@daiksy
Created January 4, 2014 03:16
Show Gist options
  • Save daiksy/8251131 to your computer and use it in GitHub Desktop.
Save daiksy/8251131 to your computer and use it in GitHub Desktop.
def qSort[T <% Ordered[T]](data: List[T]): List[T] = {
data match {
case Nil => data
case x::xs => {
qSort(xs.filter(_ < x)) ++ List(x) ++ qSort(xs.filter(x <= _))
}
}
}
qSort(List(2, 44, 5, 3, 1, 3, 9, 56, 7, 8, 4, 111, 0, 3, 4)) foreach println
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment