Re: [中學] 對數
※ 引述《magic704226 (梅姬?沒雞?傻傻分不清楚)》之銘言:
: The complexity of a problem is O(log10n) and the computer
: executes 1 million instructions per second.
: How long does it take to run the program if the number
: of operations is 10,000?
: a. 1 microsecond
: b. 2 microseconds
: c. 3 microseconds
: d. 4 microseconds
: 答案是 4 microsecond
: 令 log(k*10*1000000)
: k=1/(10^6)
: 10000代入之後就卡住了
The complexity of a problem is O(log10n)的n通常就是instruction的數量
所以log 10000 = 4 表示10000個指令需要4個單位的執行時間
10
the computer executes 1 million instructions per second
6 -6
也就是1秒可執行10 個指令 => 1個指令需要10 秒
-6
所以這10000個指令需要 4*10 秒,即4 microseconds
-6
(所以是log N *10 sec for N instructions)
10
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.47.64.252 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Math/M.1676881902.A.914.html