CountingSort

← Back to Gallery

How Counting Sort Works

Counting Sort is a non-comparative sorting algorithm that counts occurrences of each value. It works in three phases: Count (tally each element), Cumulate (convert counts to positions), and Place (build sorted output by placing elements at their correct positions). Time complexity: O(n + k) where k is the range of input values. Best for small integer ranges.

Elements: 12 Range: 0–9 Step: 0
Ready — Press Start or Step
Default
Counting
Placing
Sorted