It took me a while, but the surprising part is that the inner loop goes back to the first element again, unlike bubble sort which never revisits the outer loop's elements. So, at some point you'll compare element 3 with element 1, and swap so that 3 is smaller than 1, which is surprising.