Edényrendezés (Bucket sort)

Animáció

Struktogram

$BucketSort(L : list)$

$n :=$ the length of $L$
$B : list[n]$
$j:= 0 \space to \space n-1$
Let $B[j]$ be empty list
$L \neq \emptyset$
Remove the first element of list $L$
Insert this element according to its key $k$ into list $B[ \lfloor n \cdot k \rfloor ]$
$j := 0 \space to \space n-1$
Sort list $B[j]$ nondecreasingly
Append lists $B[0], B[1], ... , B[n-1]$ in order into list $L$

Feladatok