Last active
November 20, 2016 04:29
-
-
Save czheo/70286246abc6b2c9cc54e2583083a03a to your computer and use it in GitHub Desktop.
merge sort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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