Count the loops
n is the length of the array
The outer (i) loop executes from 0 to n-2
n-1 times
The on each cycle of the outer loop i has a certain (different) value
On each cycle of the outer loop, the inner loop executes from I + 1 to n –1
n – i – 1 times
Previous slide
Next slide
Back to first slide
View graphic version