For the given program what will be the time complexity.
int count = 0;
for(int i = n; i > 0; i /= 2)
{
for(int j = 0; j < i; j++)
{
count++;
}
}
To my understanding, it should be O(nlogn) because the i loop is divide and conquer and hence O(logn) and the j loop is O(n).
However, the correct answer is O(n). Can someone explain why?