Guest User

Untitled

a guest
Feb 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. # Non-destructive Quicksort.
  2. def quicksort(list)
  3. return list if list.size <= 1
  4. left, right = list.partition { |e| e < list.first }
  5. pivot = right.shift
  6. quicksort(left) + [pivot] + quicksort(right)
  7. end
Add Comment
Please, Sign In to add comment