Bubble Sort
Repeatedly compares neighboring values and swaps them until the largest values bubble to the end.
Formula
Comparisons: Σ(i=1→n-1) i = n(n-1)/2
Pseudocode
for i = 0 to n - 2
for j = 0 to n - 2 - i
if A[j] > A[j + 1]
swap(A[j], A[j + 1])