object sortDemo {
def qSort(a: List[Int]): List[Int] = {
if (a.length < 2) a
else qSort(a.filter(a.head > _)) ++
a.filter(a.head == _) ++
qSort(a.filter(a.head < _))
}
def main(args: Array[String]): Unit = {
println(qSort(List(6,4,5,3,1,2,9,8,0)))
}
}

实现快速排序


块

快排

快排
https://docs.scala-lang.org/overviews/collections/introduction.html



随堂笔记--
Scala实现快速排序
