O(n²) · comparison sort

Sorting Algorithm Visualizer

Bubble Sort

Adjacent pairs are compared and, if out of order, swapped. Each pass pushes the largest remaining value to the end — repeat until nothing moves.