Complete the code to declare the count array with the correct size.
int count[[1] + 1] = {0};
The count array size should be based on the maximum value in the input array to cover all possible values.
Complete the code to increment the count of the current element.
count[arr[i]][1];We increment the count for the element at arr[i] by 1 to record its frequency.
Fix the error in updating the count array to hold cumulative counts.
for (int i = 1; i <= [1]; i++) { count[i] = count[i] [2] count[i - 1]; }
The cumulative count is calculated by adding the previous count to the current count.
Fill both blanks to place elements in the output array in correct order.
output[count[arr[i]] [1]] = arr[i]; count[arr[i]] [2];
The position is count[arr[i]] - 1 because arrays are zero-indexed, and then we decrement the count for the next occurrence.
Fill all three blanks to copy the sorted output back to the original array.
for (int i = 0; i < [1]; i++) { arr[i] = [2][[3]]; }
We copy each element from the output array back to the original array using the loop index.