VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Bubble Sort

Roman Blachman  (2 Submissions)   String Manipulation   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

This code should explain the bubble sort !
Bubble sort is a sort algorithm that sortes string in very fast way. There are many sort algorithms but this is the best !

Inputs
This code needs only one parameter: The input array (will be used for output also)

Assumes
If you have problems running it try this code. (I assume that you created a list box that his name is: lstItems) Place this code where you want (for example: command button) Dim inArray() As String ' Input array ReDim inArray(lstItems.ListCount - 1) ' Redim the array to the size of the list count items For ic = 0 To lstItems.ListCount - 1 inArray(ic) = lstItems.List(ic) ' Put all the values from the list box to the array Next cBubbleSort inArray ' Sort the array lstItems.Clear ' Clear the list For ic = 0 To UBound(inArray) lstItems.AddItem inArray(ic) ' Put the sorted items from the array Next

Returns
This sub won't return anything. It will change the input array

API Declarations
no apis.

Rate Bubble Sort (9(9 Vote))
Bubble Sort.bas

Bubble Sort Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters