next up previous
Next: Example Up: l4 Previous: Analysis Of Decision Tree

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: Example Up: l4 Previous: Analysis Of Decision Tree