CountingSort
Aus Byte-Welt Wiki
Zur Navigation springenZur Suche springenCounting ist ein stabiler Sortieralgorithmus.
Psydocode
CountingSort(A,n,k)
for i := 1 to k do C[i] := 0 for j := 1 to n do C[A[j]] := C[A[j]] + 1 for i := 1 to k do C[i] := C[i] + C[i - 1] for j := 1 to n do B[C[A[j]]] := A[j] C[A[j]] := C[A[j]] - 1 for j := 1 to n do A[j] := B[j]