I am working through Herbert Schildt's beginners C++ and I can't get my head around an element of the bubble sort. In the fragment:

Code:

`// this is the bubble sort`

for(a=1; a<size; a++)

for(b=size-1; b>=a; b--) {

if(nums[b-1] > nums[b]) { // if out of order

// exchange elements

t = nums[b-1];

nums[b-1] = nums[b];

nums[b] = t;

}

}

The two for statements seem to indicate that "a" will count up and continue until it reaches constant "size" while "b" will count down through the array until it's value is equal to "a". Given that "a" is counting up and that "b" is counting down, it seems to me that the two will meet in the middle.

I can't get my head around how, with this, any of the array below that point will be sorted.

I would appreciate it if someone would be able to explain it in simple terms.

Thanks!