def qsort(list:List[Int]):List[Int] =
{
 list match {
 case x::xs => qsort(xs filter(_<x) ) ::: x :: qsort(xs filter(_>x))
 case Nil => Nil
 }
}

print(qsort(List(4,6,5,0,2,3,1,7,8,9)))

Short and sweet!…



No Responses Yet to “Quick sort in Scala”  

  1. No Comments Yet

Leave a Reply