Learn
Merge Sort: Python
Finishing the Merge
Since we’ve only technically depleted one of our two inputs to merge()
, we want to add in the rest of the values to finish off our merge()
function and return the sorted list.
Instructions
1.
After our while
loop, check if there are any elements still in left
.
If there are, add those elements to the end of result
.
2.
After checking for elements in left
let’s check if there are elements in right
. If there are, add them to result
.