Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,36 @@
Randomize
Dim n(9) 'nine is the upperbound.
'since VBS arrays are 0-based, it will have 10 elements.
For L = 0 to 9
n(L) = Int(Rnd * 32768)
Next
WScript.StdOut.Write "ORIGINAL : "
For L = 0 to 9
WScript.StdOut.Write n(L) & ";"
Next
InsertionSort n
WScript.StdOut.Write vbCrLf & " SORTED : "
For L = 0 to 9
WScript.StdOut.Write n(L) & ";"
Next
'the function
Sub InsertionSort(theList)
For insertionElementIndex = 1 To UBound(theList)
insertionElement = theList(insertionElementIndex)
j = insertionElementIndex - 1
Do While j >= 0
'necessary for BASICs without short-circuit evaluation
If insertionElement < theList(j) Then
theList(j + 1) = theList(j)
j = j - 1
Else
Exit Do
End If
Loop
theList(j + 1) = insertionElement
Next
End Sub