Sorting algorithms/Radix sort: Difference between revisions
→{{header|EasyLang}}
Line 1,358:
<syntaxhighlight lang="text">
# radix = 10
radix = 256
max = 0
for di = 1 to len d[]
if d[di] > max
max = d[di]
.▼
.▼
len buck[][] radix▼
pos = 1▼
while pos <= max▼
for i = 1 to radix▼
len buck[i][] 0▼
.▼
for di = 1 to len d[]▼
h = d[di] div pos mod radix + 1▼
buck[h][] &= d[di]▼
.▼
di = 1▼
for i = 1 to radix▼
for j = 1 to len buck[i][]▼
d[di] = buck[i][j]▼
di += 1▼
.
len
▲ pos = 1
▲ while pos <= max
▲ for i = 1 to radix
▲ .
▲ for di = 1 to len d[]
▲ h = d[di] div pos mod radix + 1
▲ .
▲ di = 1
▲ for i = 1 to radix
▲ for j = 1 to len buck[i][]
▲ .
pos *= radix
.
data[] = [ 29 4 72 44 55 26 27 77 92 5 ]
|