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
Gaussian integer Gaussian integer In number theory, a Gaussian integer is a complex number whose real and imaginary parts are both integers. The Gaussian integers, with ordinary addition and multiplication of complex numbers, form an integral domain, usually written as . This integral domain is a particular case of a commutative ring of quadratic integers. It does not have a total ordering that respects arithmetic. The Gaussian integers are the set In other words, a Gaussian integer is a complex number such that its real and imaginary parts are both integers. Since the Gaussian integers are closed under addition and multiplication, they