Counting Sort
Visualize Counting Sort with counting array and placement.
Free theory articleVisualize Counting Sort with counting array and placement.
Concept & interpretation
Counting Sort is an integer sorting algorithm that operates by counting the number of objects that possess distinct key values, and applying prefix sum to those counts to determine the positions of each key value in the output sequence. Unlike Quick Sort or Merge Sort, it is not a comparison sort, which allows it to break the Ω(n log n) lower bound for sorting.