单选题:For the following function (where $$n>0$$)```int func ( int n ){
For the following function (where $$n>0$$)
```
int func ( int n )
{ int i = 1, sum = 0;
while ( n > sum ) { i *= 2; sum += i; }
return i;
}
```
the most accurate time complexity bound is:
@[D](1)
A. $$O(2^n)$$
B. $$O(n)$$
C. $$O(n\log n)$$
D. $$O(\log n)$$
A.$$O(2^n)$$
B.$$O(n)$$
C.$$O(n\log n)$$
D.$$O(\log n)$$
答案:D
```
int func ( int n )
{ int i = 1, sum = 0;
while ( n > sum ) { i *= 2; sum += i; }
return i;
}
```
the most accurate time complexity bound is:
@[D](1)
A. $$O(2^n)$$
B. $$O(n)$$
C. $$O(n\log n)$$
D. $$O(\log n)$$
A.$$O(2^n)$$
B.$$O(n)$$
C.$$O(n\log n)$$
D.$$O(\log n)$$
答案:D