Write RadixSort for non-negative integers. Sort by the least significant digit first: one stable counting-sort pass per decimal digit (units, tens, hundreds, …), as many passes as the largest value has digits. Print the array after every pass.
For the input
8
170 45 75 90 802 24 2 66
the program prints
after digit 1: [170, 90, 802, 2, 24, 45, 75, 66]
after digit 10: [802, 2, 24, 45, 66, 170, 75, 90]
after digit 100: [2, 24, 45, 66, 75, 90, 170, 802]
Sorted in 3 passes (the largest value has 3 digits)
Why would the result be wrong if a pass were not stable?