the algorithm compares pairs of elements in a list. the elements the 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.