Skip to Content
Learn
Merge Sort: Python
Finishing the Sort

Let’s update our merge_sort() function so that it returns a sorted list finally!

Instructions

1.

In merge_sort() create two new variables: left_sorted and right_sorted.

left_sorted should be the result of calling merge_sort() recursively on left_split.

right_sorted should be the result of calling merge_sort() recursively on right_split.

2.

Erase the “return” line and change it to return the result of calling merge() on left_sorted and right_sorted.

Folder Icon

Sign up to start coding

Already have an account?