测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A27228. 现在用如下代码来计算下 xn,其时间复杂度为( )double quick_power(double x,unsigned n){ if(n == 0)return 1; if(n == 1)return x; return quick_power(x, n/2) *quick_power(x,n/2) *((n&1)?x:1); }

单选题 容易

题目描述

现在用如下代码来计算下 xn,其时间复杂度为(    )

double quick_power(double x,unsigned n){
	if(n == 0)return 1;
	if(n == 1)return x;
	return quick_power(x, n/2)
					*quick_power(x,n/2)
					*((n&1)?x:1);
}

选项(单选)

上一题 下一题