What are bubble sort algorithms?
Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing two items at a time and swapping them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm gets its name from the way smaller elements “bubble” to the top of the list. Because it only uses comparisons to operate on elements, it is a comparison sort.
Start: Loop through all elements of an array if item[2] less than item[1] then save = item[1] item[1] = item[2] item[2] = save Go back to Start A simple bubble sort in VB this would be do bChange = False for i = lbound(array) to ubound(array) -1 if array(i+1) < array(i) then vSave array(i) array(i) = array(i+1) array(i) = vSave bChange = True end if next i loop while bChange = True