Bubble sort is composed of two loops, one inside the other, the idea is to push the largest number on the right most side of the list, one by one.
For the sake of discussion, we'll call a the outer loop and b the inner loop.
astarts atlist.length - 1, last step occurs at0.bstarts at0, last step occurs ata - 1, i.e., ifa = 3, then last step ofbwould be2.