next up previous
Next: Example Up: CSE 2320: Algorithms and 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)$.

Copyright © 1998 The University of Texas at Arlington