Counting Sort 2

  • + 0 comments
    def countingSort(arr):
        # Write your code here
        
        new_arr = [0] * 100
        
        for i in arr:
            new_arr[i] += 1
        sorted_arr = []  
        for i in range(len(new_arr)):
            for j in range(new_arr[i]):
                sorted_arr.append(i)
                
        return sorted_arr