codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Shell Sort on 2 Dimensional Array  jjordan354 at 16:50 on Friday, April 09, 2004
 

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?









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: Security - Code verify
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  IPC problem
•  Re: import contacts of msn/yahoo
•  Cookies and Threads C++
•  right justify a background in a table?
•  Help with Loop (C++/MFC)
•  Help with Loop (C++/MFC)


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007