Drag and drop the lines into the box on the right. This is a simplified version of the code, which is usually decomposed into the partition (or division) task, and the merge part, which merges two sorted lists.
Drag from here
return list(merge(left, right))
left = merge_sort(left)
return m
right = merge_sort(right)
right = m[middle:]
def merge_sort(m):
# Base case a 1 item list is sorted so return it..
if len(m)<=1:
middle = len(m)//2
from heapq import merge
# Otherwise split it two, merge sort the two and combine..