ICan’tBelieveItCanSort(A[1..n])
for i = 1 to n do
for j = 1 to n do
if A[i] < A[j] then
swap A[i] and A[j]
Example: 3412 // i=1
4312 // i=1 -> i=2
3412 // i=2 -> i=3
1432 // i=3
1342 // i=3 -> i=4
1243 // i=4
1234 // i=4
1) After an outer loop of i is finished, the first i elements are in ascending order. (For example, in the fifth line above after i=3 is finished, the first 3 elements are "124")
https://www.youtube.com/watch?v=kHS8bweLcxQ