作者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