Algorithm 1 Bubble-Sort(A[1..n]A[1..n]A[1..n])
1:for i=1i = 1i=1 to n−1n - 1n−1 do
2:for j=nj = nj=n downto i+1i + 1i+1 do
3:if A[j]<A[j−1]A[j] < A[j-1]A[j]<A[j−1] then
4:Swap(A[j],A[j−1]A[j], A[j - 1]A[j],A[j−1])
5:end if
6:end for
7:end for