high level description counting sort is a sorting technique based on keys between a specific range with efective performance on the predetermined range size of the values 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 time complexity onk where n is the number of elements in input array and k is the range of input auxiliary space onk find min and max values count number appearances in the array rearrange sequence in the array find min and max values count number appearances in the array rearrange sequence in the array
def counting_sort(arr):
    
    min_value = min(arr)
    max_value = max(arr)

    
    counting_arr = [0]*(max_value-min_value+1)
    for num in arr:
        counting_arr[num-min_value] += 1
    
    
    index = 0
    for i, count in enumerate(counting_arr):
        for _ in range(count):
            arr[index] = min_value + i
            index += 1

test_array = [3, 3, 2, 6, 4, 7, 9, 7, 8]

counting_sort(test_array)

print(test_array)