Question: CountingSort ( A , B , k ) { Let C [ 0 dotsk ] be a new array for i = 0 to k

CountingSort(A, B, k){
Let C[0dotsk] be a new array
for i=0 to k
C[i]=0
for j=1 to A.length
C[A[j]]=C[A[j]]+1
for i=1 to k
C[i]=C[i]+C[i-1];
for j= A.length downto 1
B[C[A[j]]]=A[j]
C[A[j]]=C[A[j]]-1
Run CountingSort (A,B,6) on the array ,2,0,1,3,4,6,1,3,2. What is the contents of array C after complete sorting A?. You do not need to show array B.
C=
}
CountingSort ( A , B , k ) { Let C [ 0 dotsk ] be

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!