Bubble Sort by Moin

Run Settings
LanguagePython
Language Version
Run Command
# bubble sort has a slight advantage over selection sort, it takes the advantage of data if it becomes more sorted while sorting # It has better best case scenario complexity than selection sorting # We sort the adjacent numbers again and again till our array becomes sorted. arr = [4,6,8,2,7,5,0] #7 length = len(arr) for j in range(length-1): for i in range(length-1): if arr[i] > arr[i+1]: arr[i], arr[i+1] = arr[i+1], arr[i] print(arr)
Editor Settings
Theme
Key bindings
Full width
Lines