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
Square number difference between 9 and any higher odd perfect square is eight times a triangular number minus eight. Since all triangular numbers have an odd factor, but no two values of differ by an amount containing an odd factor, the only perfect square of the form is 1, and the only perfect square of the form is 9. Square number In mathematics, a square number or perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself. For example, 9 is a square number, since it can be