Repeatedly compares adjacent elements and swaps them if they are in the wrong order.
for i from 0 to n-1 for j from 0 to n-i-2 if arr[j] > arr[j+1] swap arr[j], arr[j+1]