Data structures · Sorting

Bubble sort

The simplest way to sort a list compares neighbors and swaps them, and counting its passes shows how much work sorting takes.