Counting Sort
Counting Sort is a non-comparison sorting algorithm that counts the frequency of each key in a bounded integer range. It can achieve O(n+k) time, where k is the value range, making it excellent when k is not significantly larger than n. Its major limitation is poor memory efficiency when the key range is very large.
Time: O(n+k).
Space: O(k), or O(n+k) for stable output variants.
Works naturally for bounded integer keys.
Not suitable when the numeric range is extremely large.
Can be stable when implemented with cumulative counts and an output array.