next up previous
Next: Up: Previous:

Example

Show how n integers in the range 1 to n2 can be sorted in O(n) time.



Use a Radix-n sort.

Each digit requires n symbols, and logn n2 digits are needed (d=2, k=n).

T(n) = \(\Theta(2n \;+\; 2k)\)
= \(\Theta(2n \;+\; 2n)\)
= \(\Theta(n)\)


next up previous
Next: Up: Previous: