Counting sort is an algorithm that sorts elements by counting the number of occurrences of each unique element in an array. It works by:
1) Creating a count array to store the count of each unique object in the input array.
2) Modifying the count array to store cumulative counts.
3) Creating an output array by using the modified count array to output elements in sorted order.