Skip to content

Instantly share code, notes, and snippets.

@zallarak
Created January 12, 2012 02:05
Show Gist options
  • Save zallarak/1598089 to your computer and use it in GitHub Desktop.
Save zallarak/1598089 to your computer and use it in GitHub Desktop.
Merge sort part 2
def Merge(left, right):
output = []
x, y = 0, 0
while x < len(left) and y < len(right):
if left[x] <= right[y]:
output.append(left[x])
x += 1
else:
output.append(right[y])
y += 1
output += left[x:]
output += right[y:]
return output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment