Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue