for (i = n, j = 0; i >0; i /= 2, j += i);
|
Answer:(C)
Explanation: The variable j is initially 0 and value of j is sum of values of i. i is initialized as n and is reduced to half in each iteration. j = n/2 + n/4 + n/8 + .. + 1 = Θ(n) Note the semicolon after the for loop, so there is nothing in the body. Same as question 1 of https://www.geeksforgeeks.org/c-language-set-6/amp/
Quiz of this Question