-->
当前位置:首页 > 题库

单选题:For the following function (where $$n>0$$)```int func ( int n ){

Luz5年前 (2021-05-10)题库2312
For the following function (where $$n>0$$)
```
int func ( int n )
{ int i = 1, sum = 0;
while ( sum < n ) { sum += i; i *= 2; }
return i;
}
```
the most accurate time complexity bound is:
@[A](1)

A. $$O(\log n)$$
B. $$O(n)$$
C. $$O(n\log n)$$
D. $$O(2^n)$$



A.$$O(\log n)$$
B.$$O(n)$$
C.$$O(n\log n)$$
D.$$O(2^n)$$


答案:A