Counting Sort 2

  • + 0 comments
    #python
    def countingSort(arr):
        ls=[]
        result=[0]*(max(arr)+1)
        for x in arr:
            result[x]+=1
        for index, value in enumerate(result):
            for _ in range(value):
                ls.append(index)
        return ls