PythiloLesson 10 of 32 · progress kept in this browser

Sort by splitting and merging

Merge sort splits the list in half, sorts each half recursively and merges the two sorted halves. Merging needs only one pass because the smallest remaining item is always at the front of one half.

left, right = [1, 4], [2, 3]
# take 1, then 2, then 3, then 4
Your task

Write merge_sort(items) returning a new sorted list using merge sort, without sorted or list.sort.