You just need to apply the Bucket sort to sort any array of numbers in linear time. Since we know there will be only 1, 2 and 3, we will use a constant memory space just to count how many of each we found and then modify the array to be sorted.
You just need to apply the Bucket sort to sort any array of numbers in linear time. Since we know there will be only 1, 2 and 3, we will use a constant memory space just to count how many of each we found and then modify the array to be sorted.