|
-
Jul 5th, 2000, 08:59 PM
#1
Thread Starter
Junior Member
I'm wandering if someone can give me the pseaudo code for sorting a range of numbers.Easiest sorting method if possible.
-
Jul 5th, 2000, 09:55 PM
#2
Code:
Needed: Listbox
For i = 0 to 10 'count 0 to number 10
list1.additem i 'add to list
Next i 'loop till 10
That will automatically sort them, or if you want the user to put them in a list:
list1.additem "1"
list1.additem "6"
list1.additem "5"
list1.additem "3"
list1.additem "10"
list1.additem "7"
list1.additem "2"
list1.additem "9"
list1.additem "8"
list1.additem "4"
Set the properties list sorted to True.
-
Jul 6th, 2000, 12:45 AM
#3
transcendental analytic
This will sort your array as fast as possible:
Code:
Sub Sort(a() As String)
Dim n&, i&, j&, k&, h
n = UBound(a)
k = n \ 2
While k > 0
For i = 0 To n - k
j = i
While (j >= 0) And (a(j) > a(j + k))
h = a(j)
a(j) = a(j + k)
a(j + k) = h
If j > k Then
j = j - k
Else
j = 0
End If
Wend
Next i
k = k \ 2
Wend
End Sub
Also for sorting numbers withour loosing the order as above, use format function:
Code:
Msgbox Format("12","0000")
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
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
|