VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Bubble sort an array in less than 20 lines of code

by Brent (2 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 26th March 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Bubble sort an array in less than 20 lines of code

Rate Bubble sort an array in less than 20 lines of code



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


Download this snippet    Add to My Saved Code

Bubble sort an array in less than 20 lines of code Comments

No comments have been posted about Bubble sort an array in less than 20 lines of code. Why not be the first to post a comment about Bubble sort an array in less than 20 lines of code.

Post your comment

Subject:
Message:
0/1000 characters