Back to algorithmsPodstawowy
Counting Sort
Instead of comparing numbers, it counts how many times each value appears and then writes them out in order. Lightning fast when the values come from a small range (e.g. grades 1-6).
O(n + k)O(k)OIJOIBOBRALEMOZGIINSTALOGIK
๐งฎ Counting Sort โ Games
Play both games to master the algorithm!
๐ก
Tip: Start with Game 1 โ boxes and balls show where the count array comes from. In Game 2 you run every step of the algorithm yourself, exactly like tracing code on paper in a contest.