Bubble sort algorithm

   
        
Comparisons done:
Elements exchanged:
Legend:
13 - elements being compared
27 - sorted part of the array
7 - element being exchanged
  Operation performing:

The Bubble sort algorithm works as follows.

As you can guess, this method is called bubble sort because smaller elements are going up like bubbles in water.