1/42
Loading...
🔢What is Counting Sort?
Sort by counting occurrences, not comparing! Max value is 8, so we need count array of size 9.
🔒
Loading...
Sort by counting occurrences, not comparing! Max value is 8, so we need count array of size 9.
Counting sort is a non-comparison algorithm that sorts by counting occurrences. Since it uses counting instead of comparisons, it can sort in O(n+k) time when value range (k) is small.