Simple 1d array bubble sort module
Simply sorts a 1 dimensional array using a bubble sort algorythm.
AI
Resumo por IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Código fonte
' 'Use: ' 'Sort Array ' 'to sort (A-Z / 1-10, Accending) 'Pretty easy to update it to sort 2 or 3 dimensional arrays 'Or to sort decending ' 'Comments or any info email: [email protected] ' Public Sub sort(tmparray) Dim SortedArray As Boolean Dim start, Finish As Integer SortedArray = True start = LBound(tmparray) Finish = UBound(tmparray) Do SortedArray = True For loopcount = start To Finish - 1 If tmparray(loopcount) > tmparray(loopcount + 1) Then SortedArray = False Call swap(tmparray, loopcount, loopcount + 1) End If Next loopcount Loop Until SortedArray = True End Sub Sub swap(swparray, fpos, spos) Dim temp As Variant temp = swparray(fpos) swparray(fpos) = swparray(spos) swparray(spos) = temp End Sub Upload
Comentários originais (3)
Recuperado do Wayback Machine