← Back

πŸ”₯ Frequency Forge

Count and Reconstruct!

Phase

-

Range

-

Current

-

Output Idx

0

Step

0
πŸ“₯ Input Array
πŸ“Š Count Buckets
πŸ“€ Output Array
Generate an array with small values to see counting sort!

πŸ“– Counting Sort

Phase 1: Count frequency of each element

Phase 2: Reconstruct array from counts

Time: O(n + k) where k is the range of values

Space: O(k) for count array

Best for: Small range of integer values