-
June 20th, 2003, 06:43 AM
#1
Quick Sort code needed
I need the Quick Sort code for sorting an array.
-
June 20th, 2003, 07:44 AM
#2
I'm sure you can find some nice sort code on this forum with a simple search. Anyway, Here's the shell sort :
Code:
Dim Inter As Double
Dim iCtr As Double
Dim iCtr2 As Double
Dim bEnd As Boolean
Dim TmpVal As Variant
Inter = UBound(aRecord)
While (Inter > 1)
Inter = Inter \ 2
Do
bEnd = True
For iCtr = 1 To (UBound(aRecord) - Inter)
iCtr2 = iCtr + Inter
' compare values here
If (aRecord(iCtr) > Mod_Def.aRecord(iCtr2)) Then
TmpVal = aRecord(iCtr)
aRecord(iCtr) = aRecord(iCtr2)
aRecord(iCtr2) = TmpVal
bEnd = False
End If
Next iCtr
Loop Until bEnd
Wend
-
June 20th, 2003, 08:01 AM
#3
Re: Quick Sort code needed
Originally posted by Sathyaish
I need the Quick Sort code for sorting an array.
VB quicksort is posted on the link below my name
phinds
vs2008, 3.5SP1 Version 9.0.21022.8 RTM
-
June 20th, 2003, 08:09 AM
#4
Thanks a bunch, phinds. And thanks Heulsay, for that code. I shall surely use it when I need shell sort. It is believed that QuickSort is the fastest.
-
June 20th, 2003, 08:16 AM
#5
My bad I must still be sleeping this morning but i read you were looking for a code that sort quickly !
Have a nice day !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|