[問題] 時間複雜度
看板Prob_Solve (計算數學 Problem Solving)作者forris (喬巴)時間16年前 (2008/03/10 23:46)推噓2(2推 0噓 2→)留言4則, 3人參與討論串1/3 (看更多)
(一).
begin
sum = 0
for i = 1 to n do
for j = 1 to n do
sum = sum + 1
end
這題是 O(n^2) 嗎?
(二).
begin
sum = 0
for i = 1 to n do begin
j = n
while j > 0 do begin
sum = sum + 1
j = [j/2]
end
end
end
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.116.194.95
推
03/10 23:49, , 1F
03/10 23:49, 1F
→
03/11 00:23, , 2F
03/11 00:23, 2F
推
03/11 00:29, , 3F
03/11 00:29, 3F
→
03/11 00:30, , 4F
03/11 00:30, 4F
討論串 (同標題文章)
Prob_Solve 近期熱門文章
PTT數位生活區 即時熱門文章