Last active
October 28, 2016 21:58
-
-
Save rbobillot/5cc132bcc734f92e50b4 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 : Seq[Int] => Seq[Int] = | |
a => (a.size < 2) match { | |
case true => a | |
case false => | |
val pivot = a(a.size / 2) | |
qsort ( | |
a filter (pivot > _)) ++ | |
(a filter (pivot == _)) ++ | |
qsort (a filter (pivot < _) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment