Counting sort is good when keys are integers in a small range 0..k. It runs in O(n + k) by counting occurrences and building the output, and it can be stable (useful as a building block for radix sort).