Step-by-step guide to counting sort with a visual example. Counting sort is useful when the range of values each item can take is very small.
For example, you can use if if you want to sort 10,000 people according to their age. We can safely assume (for now) that no human is older than 199 years old, so the range of values is very small in this case.
0 Comments