单选题 32.以下算法的时间复杂度为( )。
void fun(int n){
int i=1:
while(i<=n)
i=i*2:
}
【正确答案】 D
【答案解析】基本运算是i=i*2,设其执行时间为T(n),则2T(n)≤n,即T(n)≤log2n=O(log2n)。