Python Program for Counting Sort
Counting sort is a sorting technique based on keys between a specific range. It works by counting the number of objects having distinct key values (kind of hashing). Then doing some arithmetic to calculate the position of each object in the output sequence.
Sorted character array is eeeefggkkorss
Time Complexity: O(n+k) where n is the number of elements in the input array and k is the range of input.
Auxiliary Space: O(n+k)
Please refer complete article on Counting Sort for more details!
My Personal Notes arrow_drop_up
Please Login to comment...