Seven Bubble sort for you: which do you choose?
#10
Code: (Select All)
_Title "Only 1 pass to sort this out!"
d$ = "1,3,5,2,4,8,9,7,0,6,2,4,8,9,7,0,6,1,3,5,2,8,9,7,0,6,2"
Dim tracker(9) As Integer

p = InStr(d$, ",")
start = 1
While p
    index = Val(Mid$(d$, start, p - start))
    tracker(index) = tracker(index) + 1
    start = p + 1
    p = InStr(start, d$, ",")
Wend
index = Val(Mid$(d$, start)) ' last index

Print "sorted:"
For i = 0 To 9
    If tracker(i) Then
        For j = 1 To tracker(i)
            Print i;
        Next
    End If
Next
b = b + ...
Reply


Messages In This Thread
RE: Seven Bubble sort for you: which do you choose? - by bplus - 03-13-2023, 12:37 AM



Users browsing this thread: 7 Guest(s)