tags:

views:

53

answers:

3

for j = n − 1 to 1 step − 1 do

does this means for all j in [1 .. n-1] or [2 .. n-1] ?

+1  A: 
Raj More
Umm, don't you mean "if n is 6"? Also, most languages would do a loop where the range doesn't overlap as not doing any loops at all, not as going clear around number space until it wraps and hits the ending value from the other side.
T.E.D.
goodness me. i just correcte that.
Raj More
i was looking for the inclusive (or not) word. Thanks
Simon
+1  A: 

If n=5 then the for loop is executed 4 times with J equal to 4 then 3, then 2, and finally 1 in that order

Chris Knight
A: 

Seems pretty clear to me. That means it counts down from n-1 to 1.

T.E.D.