-->
当前位置:首页 > 题库 > 正文内容

单选题:Let n be a non-negative integer representing the size of input.

Luz4年前 (2022-01-18)题库1456
Let $$n$$ be a non-negative integer representing the size of input. The time complexity of the following piece of code is:

void func(int n) {
int i = 1;

while(i <= n)
i = i*2;
}




A.$$O(n) $$
B.$$O(n^2) $$
C.$$O(\log_2n) $$
D.$$O(n^{1/2}) $$


答案:C

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。