Bubble Sort: Execution Mechanism:
- # Two pairs are smaller than the first
- # outer loop n-1
- # inner loop n-1-i
-
l=[2,1,7,55,45,35,33,29,98,77,68,58,76,99,70,36]; for i in range(len(l)-1):#outer loop n-1 for j in range(len(l)-1-i):#n-1#Outer loop n-1-i if l[j]>l[j+1]: l[j],l[j+1]=l[j+1],l[j]; print(l);