I thought first loop is logN.

i th value like below

Ai = N * ( 1 / 2^(i-1) )

when iteration was done, i = 1

so last time Ak = N * ( 1 / 2^(i-1) ) = 1

Then, i = logN

why is this wrong?

I thought first loop is logN.

i th value like below

Ai = N * ( 1 / 2^(i-1) )

when iteration was done, i = 1

so last time Ak = N * ( 1 / 2^(i-1) ) = 1

Then, i = logN

why is this wrong?

i=N // in first iteration for j . In a first go , J will run N times then N/2 then so