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
Non-integer representation integer "k" such that . Set and For , put In other words, the canonical β-expansion of "x" is defined by choosing the largest "d" such that , then choosing the largest "d" such that , etc. Thus it chooses the lexicographically largest string representing "x". With an integer base, this defines the usual radix expansion for the number "x". This construction extends the usual algorithm to possibly non-integer values of β. Base behaves in a very similar way to base 2 as all one has to do to convert a number from binary into base is put a zero