June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -0,0 +1,43 @@
|
|||
Public Sub Main()
|
||||
Dim siToSort As Short[] = [249, 28, 111, 36, 171, 98, 29, 448, 44, 147, 154, 46, 102, 183, 24,
|
||||
120, 19, 123, 2, 17, 226, 11, 211, 25, 191, 205, 77]
|
||||
Dim siStart As Short
|
||||
Dim siGap As Short = siToSort.Max
|
||||
Dim bSorting, bGap1 As Boolean
|
||||
|
||||
Print "To sort: -"
|
||||
ShowWorking(siToSort)
|
||||
Print
|
||||
|
||||
Repeat
|
||||
bSorting = False
|
||||
siStart = 0
|
||||
If siGap = 1 Then bGap1 = True
|
||||
|
||||
Repeat
|
||||
If siToSort[siStart] > siToSort[siStart + siGap] Then
|
||||
Swap siToSort[siStart], siToSort[siStart + siGap]
|
||||
bSorting = True
|
||||
End If
|
||||
Inc siStart
|
||||
Until siStart + siGap > siToSort.Max
|
||||
|
||||
If bSorting Then ShowWorking(siToSort)
|
||||
siGap /= 1.3
|
||||
If siGap < 1 Then siGap = 1
|
||||
|
||||
Until bSorting = False And bGap1 = True
|
||||
|
||||
End
|
||||
'-----------------------------------------
|
||||
Public Sub ShowWorking(siToSort As Short[])
|
||||
Dim siCount As Short
|
||||
|
||||
For siCount = 0 To siToSort.Max
|
||||
Print Str(siToSort[siCount]);
|
||||
If siCount <> siToSort.Max Then Print ",";
|
||||
Next
|
||||
|
||||
Print
|
||||
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue