## Total time: O(n + k)

- Usually, k = O(n)
- Thus counting sort runs in O(n) time

## But sorting is ?(n lg n)!

- No contradiction--this is not a comparison sort (in fact, there are no comparisons at all!)
- Notice that this algorithm is stable

Previous slide | Next slide | Back to first slide | View graphic version |