Sorting algorithm written with Scala .