Bubble Sort is the easiest sorting algorithm that works by repeatedly swapping the adjacent elements if they are placed in wrong order.
Python Program for Bubble Sort
# Python program to implementation Bubble Sort
def bubble_Sort(alist):
n = len(alist)
# Traversing through all array elements
for j in range(n):
for k in range(0, n-j-1):
if alist[k] > alist[k+1] :
alist[k], alist[k+1] = alist[k+1], alist[k]
alist = [111,24,22,11,122,19,99,121,5,14]
bubble_Sort(alist)
print ("Sorted array elements are :")
for i in range(len(alist)):
print ("%d" %alist[i]),
Output:-
Sorted array elements are : 5 11 14 19 22 24 99 111 121 122