"""
基数排序
"""
class CountingSort:
    def countingSort(self, A, n):
        # write code here
        maxA, minA = max(A), min(A)
        hash = [0] * (maxA - minA + 1)
        for num in A:
            hash[num - minA] += 1
        A = []
        for i, v in enumerate(hash):
            A += [i+minA] * v
        return A

cs = CountingSort()
A = [1,2,3,5,2,3]

print(cs.countingSort(A, 6))
586663acea3cfef3fae917cc4b9eb63f5e0bbdc8
<mask token>


class CountingSort:
    <mask token>


<mask token>

<mask token>


class CountingSort:

    def countingSort(self, A, n):
        maxA, minA = max(A), min(A)
        hash = [0] * (maxA - minA + 1)
        for num in A:
            hash[num - minA] += 1
        A = []
        for i, v in enumerate(hash):
            A += [i + minA] * v
        return A


<mask token>

<mask token>


class CountingSort:

    def countingSort(self, A, n):
        maxA, minA = max(A), min(A)
        hash = [0] * (maxA - minA + 1)
        for num in A:
            hash[num - minA] += 1
        A = []
        for i, v in enumerate(hash):
            A += [i + minA] * v
        return A


<mask token>
print(cs.countingSort(A, 6))

<mask token>


class CountingSort:

    def countingSort(self, A, n):
        maxA, minA = max(A), min(A)
        hash = [0] * (maxA - minA + 1)
        for num in A:
            hash[num - minA] += 1
        A = []
        for i, v in enumerate(hash):
            A += [i + minA] * v
        return A


cs = CountingSort()
A = [1, 2, 3, 5, 2, 3]
print(cs.countingSort(A, 6))

"""
基数排序
"""
class CountingSort:
    def countingSort(self, A, n):
        # write code here
        maxA, minA = max(A), min(A)
        hash = [0] * (maxA - minA + 1)
        for num in A:
            hash[num - minA] += 1
        A = []
        for i, v in enumerate(hash):
            A += [i+minA] * v
        return A

cs = CountingSort()
A = [1,2,3,5,2,3]

print(cs.countingSort(A, 6))