Bubble sort
The algorithm compares pairs of elements in a list. The elements that make up the pairs are next to each other. Starting at one end of the list, the two elements in each pair are compared to each other in order. That means for example, the first and second element are compared, then the second and third element, and then the third and fourth, and so on. If the elements in the current pair are out of order, then the two elements switch places. This process – of comparing two elements – is done over and over again, until the whole list is sorted. The list is sorted, when there are no more pairs that have to be swapped.