Skip to content

Instantly share code, notes, and snippets.

@SamGerber-zz
Created January 8, 2016 07:27
Show Gist options
  • Save SamGerber-zz/41da601ab4b368257edf to your computer and use it in GitHub Desktop.
Save SamGerber-zz/41da601ab4b368257edf to your computer and use it in GitHub Desktop.
code embed test
class Array
def merge_sort(&prc)
return self if count < 2
prc ||= proc { |left, right| left <=> right }
left = self[0...(count / 2)]
right = self[(count / 2)..-1]
Array.merge(left, right, &prc)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment