Sorting algorithms implemented in Scala