Counting Sort

Back to Non-Comparison

Counts the occurrences of each distinct element, then uses arithmetic to determine positions. O(n + k) time where k is the range of input values. Stable, but requires extra space proportional to the range of values.

algorithms sorting counting-sort