Complete the code to find the middle index for dividing the array.
int mid = (left [1] right) / 2;
The middle index is found by adding left and right, then dividing by 2.
Complete the recursive call to sort the left half of the array.
mergeSort(arr, [1], mid);The left boundary is passed as the start index for sorting the left half.
Fix the error in the merge function call to merge two halves correctly.
merge(arr, left, [1], right);The middle index plus one is the start of the right half for merging.
Fill both blanks to complete the loop copying elements back to the original array.
for (int k = [1]; k <= [2]; k++) { arr[k] = temp[k]; }
The loop copies elements from left to right indices back to the original array.
Fill all three blanks to complete the merge function's main merging loop.
while (i <= [1] && j <= [2]) { if (arr[i] <= arr[j]) { temp[k++] = arr[[3]++]; } else { temp[k++] = arr[j++]; } }
The loop runs while i is less or equal to mid and j less or equal to right. The element at i is copied and i is incremented.