[問題] 資料結構的一些問題
有兩題資料結構的問題想要請教一下!!
題目如下:
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
推
04/19 18:13, , 1F
04/19 18:13, 1F
→
04/19 18:33, , 2F
04/19 18:33, 2F