Bubble sort, aka sinking sort is a basic algorithm
for arranging a string of numbers or other elements
in the correct order. This sorting algorithm is
comparison-based algorithm in which each pair of
adjacent elements is compared and the elements are
swapped if they are not in order. The algorithm then
repeats this process until it can run through the
entire string or other elements and find no two
elements that need to be swapped. This algorithm is
not suitable for large data sets as its average and
worst case complexity are of Ο(n2) where n is the number of items.
In general, Just like the movement of air bubbles
in the water that rise up to the surface, each element
of the array move to the end in each iteration.
Therefore, it is called a bubble sort.