Bubblesort sorts values by comparing the first two values. If they are incorrectly ordered they are swapped. Then the second is compared with the third. this continues to the end. At the end the last value is sorted out. This is repeated until it is sorted.