next up previous
Next: Up: Previous:

Counting Sort



Assume algorithm is input n elements ranging from 1 to k.

Find the number of elements \(j \leq A[i]\) and put A[i] in B[j].

If k = O(n), then T(n) for counting sort = $\Theta(n)$.


next up previous
Next: Up: Previous: