133
правки
Изменения
→Псевдокод
'''ComplexCountingSort'''
'''for''' i = 0 '''to''' k - 1
P[i] = 0;
'''for''' i = 0 '''to''' length[A] - 1
P[A[i].key] = P[A[i].key] + 1;
carry = 0;
'''for''' i = 0 '''to''' k - 1
temporary = P[i];
P[i] = carry;
carry = carry + temporary;
'''for''' i = 0 '''to''' length[A] - 1
B[P[A[i].key]] = A[i];