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
Algebraic integer . Each algebraic integer belongs to the ring of integers of some number field. A number is an algebraic integer if and only if the ring is finitely generated as an Abelian group, which is to say, as a -module. The following are equivalent definitions of an algebraic integer. Let be a number field (i.e., a finite extension of , the set of rational numbers), in other words, for some algebraic number by the primitive element theorem. Algebraic integers are a special case of integral elements of a ring extension. In particular, an algebraic integer is an integral element of