Created
January 4, 2014 03:16
-
-
Save daiksy/8251131 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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