Created
October 13, 2014 09:45
-
-
Save akirillov/436be17d83fbb8eac0be to your computer and use it in GitHub Desktop.
Scala QuickSort
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 sort(list: List[Int]): List[Int] = { | |
list match { | |
case Nil => list | |
case _ => sort(list.tail.filter(_ <= list.head)) ::: list.head :: sort(list.tail.filter(_ > list.head)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment