-1
我有以下僞代碼,我想確定它的運行時間T(n)。 有人可以給我我應該遵循的步驟嗎? 下面是代碼:確定僞代碼的運行時間
i := 1;
while (i <= n)
j := i;
x := x+A[i];
while (j > 0)
y := x/(2*j);
j = j /2; // Assume here that this returns the floor of the quotient
i = 2 * i;
return y;
@saydak更新了計算 –