AlgoThrive
← All sorting algorithms

Counting Sort

DefaultComparingSwappingPivotSorted
Main Array Workflow
8
3
11
6
1
9
4
7

pseudocode

find max value k in array
count = array of size k+1 initialized to 0
for each element x in a: count[x]++
reconstruct array a using count frequencies

Frame 1 / 19

Start

unsorted array

4

3–16 integers between 1 and 20.