Bubble sort an array in less than 20 lines of code
Bubble sort an array in less than 20 lines of code
Rate Bubble sort an array in less than 20 lines of code
(1(1 Vote))
Dim Fnames() As Long
Dim I As Integer
Dim swop As Boolean
Dim a, B As Long
Dim Arrterms As Integer
swop = False
Do While True
For I = 0 To Arrterms - 1
If Fnames(I) > Fnames(I + 1) Then
a = Fnames(I)
B = Fnames(I + 1)
Fnames(I) = B
Fnames(I + 1) = a
swop = True
End If
Next I
If I = Arrterms Then I = 0
If swop = False Then Exit Do
swop = False
Loop
Bubble sort an array in less than 20 lines of code Comments
No comments yet — be the first to post one!
Post a Comment