[課業] 時間複雜度請教
for i=0 to n do //是O(n+1)
begin
j=i; //這邊是O(n)嗎
while j >0 do j=j/2; //這邊寫在同一行,所以算O(log n)還是while判斷也要算?
end
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 54.183.135.27
※ 文章網址: https://www.ptt.cc/bbs/Examination/M.1493935341.A.4F9.html
推
05/05 11:38, , 1F
05/05 11:38, 1F
→
05/05 11:46, , 2F
05/05 11:46, 2F
→
05/05 11:46, , 3F
05/05 11:46, 3F
→
05/05 11:47, , 4F
05/05 11:47, 4F