Complete the code to initialize the count array with zeros for counting sort.
count = [0] * [1]
The count array size must be one more than the maximum value in the input array to cover all possible values.
Complete the code to count the occurrences of each element in the input array.
for num in arr: count[[1]] += 1
We use the current number 'num' as the index to increment its count.
Fix the error in updating the count array to store cumulative counts.
for i in range(1, len(count)): count[i] = count[i] [1] count[i - 1]
Cumulative counts are calculated by adding the previous count to the current count.
Fill both blanks to place elements in the output array in correct order.
for num in reversed(arr): output[count[[1]] - 1] = num count[[2]] -= 1
Use 'num' as the index to access and update the count array for correct placement.
Fill all three blanks to copy the sorted elements back to the original array.
for i in range(len(arr)): arr[[1]] = output[[2]] [3]
We copy each element from output to arr using the same index 'i'. No increment needed inside the loop header.
