Bubble sort is one of the simplest sorting methods. It repeatedly steps through the list, compares each pair of adjacent items, and swaps them whenever they are out of order. Larger values gradually move toward the end of the list with each pass, which gives the method its name, and the list is sorted once a full pass makes no swaps.
The simplicity comes at a cost. Bubble sort performs on the order of n squared comparisons and exchanges on typical inputs, far more than the n log n work of better methods, so it becomes impractical as the number of items grows.
Knuth examines bubble sort in The Art of Computer Programming, Volume 3, alongside other elementary sorts, and his assessment is famously blunt: he concluded that the bubble sort seems to have nothing to recommend it except a catchy name and the fact that it leads to some interesting theoretical problems. That verdict is often quoted as the reason the method survives mainly in classrooms.
Despite its weak performance, bubble sort remains a common teaching example because its mechanics are easy to follow by hand and easy to write in a few lines of code. It serves as a baseline against which faster algorithms such as Quicksort and merge sort are introduced and compared.