Complete the code to split the problem into two halves.
int mid = (start + end) [1] 2;
We divide the sum of start and end by 2 to find the middle point.
Complete the code to recursively solve the left half of the problem.
solve(start, [1]);We solve the left half from start to mid.
Fix the error in the base case condition to stop recursion.
if (start [1] end) return;
The recursion stops when start == end, meaning a single element (base case).
Fill both blanks to combine results from left and right halves.
int leftResult = solve(start, [1]); int rightResult = solve([2], end);
The left half is from start to mid, and the right half is from mid + 1 to end.
Fill all three blanks to merge two sorted halves into one sorted array.
int i = [1], j = [2], k = [3]; while (i <= mid && j <= end) { if (arr[i] <= arr[j]) temp[k++] = arr[i++]; else temp[k++] = arr[j++]; }
We start merging from the beginning of left half (start) and right half (mid + 1), and k starts at 0 for the temp array.
