[理工] [資結]-時間複雜度
Let T(n) be the running time of Foo(n). Find the order of T.
Foo(int n){
for i from 1 to n
x = n
while x > 0 do
x = x - i
}
為什麼是O(nlgn)?
不是O(n)嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.116.218.120
推
12/03 23:22, , 1F
12/03 23:22, 1F
→
12/04 18:44, , 2F
12/04 18:44, 2F
→
12/04 18:45, , 3F
12/04 18:45, 3F
推
12/05 01:31, , 4F
12/05 01:31, 4F
討論串 (同標題文章)