Mental Model
Bubble sort compares pairs of neighbors and swaps them if they are in the wrong order, pushing the largest unsorted value to the end each pass.
Analogy: Imagine bubbles rising in water: the biggest bubble slowly moves up to the surface by swapping places with smaller bubbles below it.
Array: [5, 3, 8, 4, 2] Indexes: 0 1 2 3 4