Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sort(array: Array[Int]): Array[Int] = {
- if (array.length < 2) array
- else {
- val pivot = array(array.length / 2) sort(array filter(pivot >)) ++ (array filter(pivot ==)) ++ sort(array filter(pivot <))
- }
- }
Add Comment
Please, Sign In to add comment