HINT: The modulo % operator yields the remainder of division and the quotient is ignored.
HENCE: 5 ÷ 2 = 2.5, but 5 % 2 = 1 {1 remaining after dividing 5 by 2}. Refresh this page. |
9 random numbers | 217 | 319 | 100 | 197 | 240 | 175 | 395 | 454 | 243 |
---|---|---|---|---|---|---|---|---|---|
multiply by 1 | 217 | 319 | 100 | 197 | 240 | 175 | 395 | 454 | 243 |
sort from left to right | 100 | 175 | 197 | 217 | 240 | 243 | 319 | 395 | 454 |
shift to the right | 0 | 100 | 175 | 197 | 217 | 240 | 243 | 319 | 395 |
modulo remainder | 100 | 75 | 22 | 20 | 23 | 3 | 76 | 76 | 59 |
sort from left to right | 3 | 20 | 22 | 23 | 59 | 75 | 76 | 76 | 100 |
shift to the right | 0 | 3 | 20 | 22 | 23 | 59 | 75 | 76 | 76 |
modulo remainder | 3 | 2 | 2 | 1 | 13 | 16 | 1 | 0 | 24 |
sort from left to right | 1 | 1 | 2 | 2 | 3 | 13 | 16 | 24 | |
shift to the right | 0 | 1 | 1 | 2 | 2 | 3 | 13 | 16 | |
modulo remainder | 1 | 0 | 0 | 0 | 1 | 1 | 3 | 8 | |
sort from left to right | 1 | 1 | 1 | 3 | 8 | ||||
shift to the right | 0 | 1 | 1 | 1 | 3 | ||||
modulo remainder | 1 | 0 | 0 | 0 | 2 | ||||
sort from left to right | 1 | 2 | |||||||
shift to the right | 0 | 1 | |||||||
modulo remainder | 1 | 0 |