License Public Domain
 Lines 18
##### Keywords
algorithm (8) functional programming (1) quicksort (5) sort (5)
##### Permissions
Owner: Stou S.
Viewable by Everyone
Editable by All Siafoo Users
Free your code from a slow death on your hard drive

# Functional Implementation of Quicksort 0

 In Brief A Scala implementation of Quick Sort using functional programming techniques. Compare this clean and delicious implementation to the considerably longer imperative version
 Language Scala
# 's
` 1/** Quick sort, functional style */ 2object FunctionalQuickSort { 3 4  def sort(a: List[Int]): List[Int] = { 5    if (a.length < 2) 6      a 7    else { 8      val pivot = a(a.length / 2) 9      sort(a.filter(_ < pivot)) :::10           a.filter(_ == pivot) :::11           sort(a.filter(_ > pivot))12    }13  }1415  def main(args: Array[String]) {16    val xs = List(6, 2, 8, 5, 1)17    println(xs)18    println(sort(xs))19  }20}`

A Scala implementation of Quick Sort using functional programming techniques. Compare this clean and delicious implementation to the considerably longer imperative version