Counting Sort 2

  • + 2 comments

    Alternately you can use enumerate to call the index

    count = [0] * 100
    for i in arr:
        count[i] += 1
    
    sort = []
    for i, n in enumerate(count):
        sort.extend([i] * n)  
              
    return sort