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
Comparison sort An identical upper bound follows from the existence of the algorithms that attain this bound in the worst case. The above argument provides an "absolute", rather than only asymptotic lower bound on the number of comparisons, namely formula_8 comparisons. This lower bound is fairly good (it can be approached within a linear tolerance by a simple merge sort), but it is known to be inexact. For example, formula_9, but the minimal number of comparisons to sort 13 elements has been proved to be 34. Determining the "exact" number of comparisons needed to sort a given number of entries is a