03-01-2013, 12:54 PM
Code:
Dim i, j, tmp
Services.StartTransaction "BubbleSort"
For i = ( UBound( arr ) - 1 ) to 0 Step -1
For j = 0 to i
If arr( j ) > arr( j + 1 ) Then
tmp = arr( j + 1 )
arr( j + 1 ) = arr( j )
arr( j ) = tmp
End If
Next
Next
Services.EndTransaction "BubbleSort"
End Sub