Sorting algorithms/Radix sort: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: added syntax colouring the hard way) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 561: | Line 561: | ||
Table sorted. |
Table sorted. |
||
</pre> |
</pre> |
||
=={{header|Arturo}}== |
|||
<lang rebol> |
|||
radixSort: function [items][ |
|||
base: 10 |
|||
a: new items |
|||
rounds: inc floor (ln max a)/ln base |
|||
loop rounds 'i [ |
|||
buckets: array.of: 2*base [] |
|||
baseI: base ^ i |
|||
loop a 'n [ |
|||
digit: last digits n |
|||
if n >= 0 -> digit: digit + base |
|||
buckets\[digit]: buckets\[digit] ++ n |
|||
] |
|||
a: new flatten buckets |
|||
] |
|||
return a |
|||
] |
|||
print radixSort [3 1 2 8 5 7 9 4 6]</lang> |
|||
{{out}} |
|||
<pre>1 2 3 4 5 6 7 8 9</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |
||
<lang AutoHotkey>Radix_Sort(data){ |
<lang AutoHotkey>Radix_Sort(data){ |