Question: Suppose that we were to rewrite the for loop header in line 10 of the COUNTING-SORT as Show that the algorithm still works properly. Is

Suppose that we were to rewrite the for loop header in line 10 of the COUNTING-SORT as

Show that the algorithm still works properly. Is the modified algorithm stable?
COUNTING-SORT(A, B.k) 1 let C[O..k] be a new array for i =Oto k 3 C[i] = 0 4 for j= l to A. length 6 I C[i] now contains the number of elements equal to i for i 1 to k 9 II C[i] now contains the number of elements less than or equal to i. 10 for j = A. length downto 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
