Instead of dividing the list once, a recursive mergeSort will keep dividing the list in half until the sublists are one or two values in length.
When developing a recursive solution, a key step is identifying the base case of the solution. What situation will terminate the recursion? In this case, a sublist of one or two values will be our two base cases.
Let's try and work through the recursive mergeSort of a list of eight values.
Last modified: December 12, 2022
Back to A Merge Algorithm