Counting Sort
Count occurrences of each key and rebuild the array — $O(n + k)$ for keys in range $0..k$.
Easy
Stable; ideal for small integer ranges like grades or ADC codes.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.