Skip to content

Instantly share code, notes, and snippets.

@zallarak
Created January 12, 2012 01:58
Show Gist options
  • Save zallarak/1598051 to your computer and use it in GitHub Desktop.
Save zallarak/1598051 to your computer and use it in GitHub Desktop.
Merge sort part 1
def MergeSort(a):
"""
Takes a list, returns a list.
"""
if (len(a) < 2):
return a
else:
mid = (len(a)) / 2
left = a[:mid]
right = a[mid:]
left = MergeSort(left)
right = MergeSort(right)
return Merge(left, right)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment