Szétválogató rendezés (Distributing sort)

Animáció

Struktogram

$RadixSort(L : dDigitNumber <>; d : \mathbb{N})$

$i .= 1 \space to \space d$
stable sort on digit $i$

$DistributionSort(L : \mathcal{T}<>; r : \mathbb{N}; \varphi : \mathcal{T} \rightarrow [0..r))$

$B : \mathcal{T}<>[r]$
$k := 0 \space to \space r - 1$
Let $B[k]$ be empty list
$L$ is not empty
Remove the first element $x$ of list $L$
Insert $x$ at the end of $B[\varphi (x)]$
$k := r-1 \space downto \space 0$
$L := B[k] + L$

Feladatok