Counting sort initialization of the output array, each take time. Therefore, the time for the whole algorithm is the sum of the times for these steps, . Because it uses arrays of length and , the total space usage of the algorithm is also . For problem instances in which the maximum key value is significantly smaller than the number of items, counting sort can be highly space-efficient, as the only storage it uses other than its input and output arrays is the Count array which uses space . If each item to be sorted is itself an integer, and used as
Transposable integer at all the steps: and also note that: By observing the remainders at each step, we can thus perform a desired cyclic permutation by multiplication. E.g., In this manner, cyclical left or right shift of any number of positions can be performed. Less importantly, this technique can be applied to any integer to shift cyclically right or left by any given number of places for the following reason: An integer "X" shift cyclically right by "k" positions when it is multiplied by an integer "n". Prove its formula. Proof First recognize that "X" is the repeating digits of a repeating