判断题:Let n be a non-negative integer representing the size of input.
Let $$n$$ be a non-negative integer representing the size of input. The time complexity of the following piece of code is $$O(n)$$.
int func(int n){
int sum = 0;
for(int i = n; i > 0; i /= 2)
for(int j = 0; j < i; j++)
sum++;
return sum;
}
答案:TRUE
int func(int n){
int sum = 0;
for(int i = n; i > 0; i /= 2)
for(int j = 0; j < i; j++)
sum++;
return sum;
}
答案:TRUE