sorting a one dimensional array
Thank you sir...
Very simple and works GREAT.
"Bob Phillips" wrote:
A simple shell sort
Public Sub ShellSort(ByRef aryToSort() As Variant)
Dim i As Long, j As Long
Dim iLow As Long, iHigh As Long
Dim tmp As Variant
iLow = LBound(aryToSort)
iHigh = UBound(aryToSort)
j = (iHigh - iLow + 1) \ 2
Do While j 0
For i = iLow To iHigh - j
If aryToSort(i) aryToSort(i + j) Then
tmp = aryToSort(i)
aryToSort(i) = aryToSort(i + j)
aryToSort(i + j) = tmp
End If
Next i
For i = iHigh - j To iLow Step -1
If aryToSort(i) aryToSort(i + j) Then
tmp = aryToSort(i)
aryToSort(i) = aryToSort(i + j)
aryToSort(i + j) = tmp
End If
Next i
j = j \ 2
Loop
End Sub
--
HTH
Bob Phillips
(replace xxxx in the email address with gmail if mailing direct)
"Albert" wrote in message
...
Hi!
I am currently and succesfully using the QuickSort algorithm for sorting 2
dimensional arrays.
However, I now need something to sort a one dimensional alphanumeric
array.
Could some one point me to a procedure that does this?
Thanks and best regards,
Albert C
|