Counting Sort Algorithm

Counting Sort Algorithm Visually

An integer sorting algorithm that works by counting the number of objects having distinct key values and doing arithmetic to calculate positions.

Sorting Algorithm Stable Algorithm Time Complexity O(n + k) Space Complexity O(k) Non-comparison Sort Beginner Level
Counting Sort Controls
Count network-node: 0
Placements: 0
Steps: 0

Algorithm Status

Ready
Progress 0%

Array Visualization

About Counting Sort

Counting sort is an integer sorting algorithm that operates by counting the number of objects that have each distinct key value, and using arithmetic on those counts to determine the positions of each key value in the output sequence. It is a non-comparison sorting algorithm with linear time complexity, making it very efficient for sorting integers within a known range.

Time Complexity
O(n + k)
All Cases
Space Complexity
O(k)
Auxiliary

Execution Log

Operation Log
Counting sort visualization initialized
Enter array values and click Initialize to begin