Sorting algorithms/Radix sort: Difference between revisions

(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
Line 174:
MsgBox, 262144, , % Radix_Sort(d)</lang>
Outputs:<pre>2,24,45,66,75,90,170,802</pre>
 
=={{header|B4X}}==
<lang b4x>Sub RadixSort (Old() As Int)
Dim i, j As Int
Dim tmp(Old.Length) As Int
For shift = 31 To 0 Step - 1
j = 0
For i = 0 To Old.Length - 1
Dim move As Boolean = Bit.ShiftLeft(Old(i), shift) >= 0
If (shift = 0 And move = False) Or (shift <> 0 And move) Then
Old(i - j) = Old(i)
Else
tmp(j) = Old(i)
j = j + 1
End If
Next
Bit.ArrayCopy(tmp, 0, Old, Old.Length - j, j)
Next
End Sub
 
Sub Test
Dim arr() As Int = Array As Int(34, 23, 54, -123, 543, 123)
RadixSort(arr)
For Each i As Int In arr
Log(i)
Next
End Sub</lang>
'''Output:'''
<pre>
-123
23
34
54
123
543
</pre>
 
=={{header|BBC BASIC}}==
Anonymous user