Guest User

Untitled

a guest
Oct 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. def sort(xs: Array[Int]): Array[Int] = {
  2. if (xs.length <= 1) xs
  3. else {
  4. val pivot = xs(xs.length / 2)
  5. Array.concat(
  6. sort(xs filter (pivot >)),
  7. xs filter (pivot ==),
  8. sort(xs filter (pivot <)))
  9. }
  10. }
Add Comment
Please, Sign In to add comment