作者amily223 (艾米莉)
看板TransCSI
標題[問題] 資料結構的一些問題
時間Sat Apr 19 17:55:04 2008
有兩題資料結構的問題想要請教一下!!
題目如下:
1.
Choose correct statements.(複選)
(A)An algorithm must terminate after a finite number of steps.
(B)An algorithm must have one or more inputs.
(C)An algorithm must have one or more outputs.
(D)Each step of a algorithm must be unambiguous.
2.下列程式的時間複雜度(time complexity)為何?
Function testing(n)
begin
if(n=1) then return(2)
else
if(n=2) then return(4)
else
return(testing(n-1)+2*testing(n-2))
end
(A)O(n) (B)O(n log n) (C)O(n^2) (D)O(n^3)
請各位幫忙解答囉
謝謝!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 203.72.144.224
1F:推 abien:1.ACD, algorithm 定義中的五大條件去翻一下吧:") 04/19 18:13
2F:→ amily223:謝謝解答^^ 明確性被我遺忘了XD 04/19 18:33