Question: Translate the following Psuedo code into Java Input: A queue Q of N items Output: Q sorted in ascending order Algorithm RadixSort (Q, N): digit
Translate the following Psuedo code into Java

Input: A queue Q of N items Output: Q sorted in ascending order Algorithm RadixSort (Q, N): digit := 1 while StillNotZero (digit) do { for (i :=1 to 10) do { create (sublist[i]) } while (! empty Q) do { dequeue (Q, item) pile := getPile (item, digit) + 1 enqueue (sublist[pile), item) } reinitialize(Q) for (j :=1 to 10) do { while (! empty sublist()) do { dequeue (sublist[], item) enqueue (Q, item) } } digit := digit* 10 } O(N) swaps this outer loop will execute "digit times O(N) swaps
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
