Skip to content

Instantly share code, notes, and snippets.

@czheo
Last active November 20, 2016 04:29
Show Gist options
  • Save czheo/70286246abc6b2c9cc54e2583083a03a to your computer and use it in GitHub Desktop.
Save czheo/70286246abc6b2c9cc54e2583083a03a to your computer and use it in GitHub Desktop.
merge sort
def merge_sort(a):
if len(a) > 1:
mid = len(a) // 2
left = a[:mid]
right = a[mid:]
merge_sort(left)
merge_sort(right)
merge(left, right, a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment