|
How do i perform a shell sort on a 2 dimensional Array. This is whay i have so far.
I have a couple dynamic arrays like this
Dim zip() As String
Dim city() As String
Dim county() As String
Dim state() As String
In the form load i load each element into an array from a text file and then Redim each of them.
The follwoing code will sort an array of citys. How do i do this sort in order to match up the city with its corresponding zip, state and county. I have a book in front of me, but only tells me how to do a shell sort on a single dimension arry. Thanks in advance
Private Sub sortdata()
Dim gap As Double, doneflag As Boolean
Dim index As Double, temp2 As String,
gap = Int(intnum / 2)
Do While gap >= 1
Do
doneflag = True
For index = 1 To intnum - gap
If city(index) > city(index + gap) Then
temp2 = city(index)
city(index) = city(index + gap)
city(index + gap) = temp2
doneflag = False
End If
Next index
Loop Until doneflag = True
gap = Int(gap / 2)
Loop
End Sub
<Added>
I was doing a little reading and i came across a MSDN page that told me that a shell sort is not that great when it handles strings. If you think otherwise, then what can i do to edit that sort?
Also, if this will not work what type of sort can i perform and how?
|
|
|
|
|
|
|
// |