A sort which compares adjacent elements in a list and switches where necessary is a
A sort which compares adjacent elements in a list and switches where necessary is a bubble sort.
Bubble sort is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.