Question: Please clearly state your assumptions and describe clearly using pseudocode your new counting sort algorithm The objective of this assignment is to reinforce the understanding
The objective of this assignment is to reinforce the understanding of Counting Sort.. Sort, Radix Sort, and Buc ket Exercise I (30 points) Counting Sort COUNTING-SORT (A, B,k) 1 let C[O..k] be a new array 2 fori 0 to k for j = l to A.length 5 C[A[j]]-C[A[j]] + I 6 I/Cli] now contains the number of elements equal to i. 7 fori1 to k 9 10 11 // [i] now contains the number of elements less than or equal to i. for j A.length downto1 B[C[A[7]]]=A[7] Suppose that we are given a sequence A of n positive real numbers (a,, a2, a.) to sort. a) (2 points) Can you use Count Sort AS IS to sort A? Explain b) (28 points) How can you adapt Counting Sort to sort the sequence A? Clearly state your assumptions and describe clearly using pseudocode your new Counting Sort algorithm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
