69 views
 for( i = n, j = 0; i > 0; i /= 2, j +=i )

Why There is no condition check for j here

| 69 views
+1

you can declare as  many variables in for as you want. You will check conditions based on your requirement. Here the writer might not want j to act as a control variable governing the number of  times loop runs so he didnt apply any condition check which indeed is perfectly normal.

0
Here loop control variable is “i” , i will stop after logn times . In that time j will increase upto logn.
0
I am not getting how this loop will execute

Pls give one example for any value of n