算法导论中的两道题

jim77 2003-09-15 07:49:43
1.Prove that the running time of an algorithm is (-)(g(n)) if and only if its worst-case running time is O(g(n)) and its best-case running time is 欧米嘎(g(n)).

2. Prove that o(g(n))交w(g(n)) is empty set.

(-)符号就是“theta”。。。。

题目很简单,初学者求教。谢谢!

...全文
86 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jim77 2003-09-15
  • 打赏
  • 举报
回复
w 是小欧米嘎。
zzwu 2003-09-15
  • 打赏
  • 举报
回复
w(g(n)) 代表什么?
zzwu 2003-09-15
  • 打赏
  • 举报
回复
'θ'、'Ω'、'∧'等符号都能用Word找到,我把你找出来了:

1.Prove that the running time of an algorithm is θ(g(n)) if and only if its worst-case running time is O(g(n)) and its best-case running time is Ω(g(n)).

2. Prove that o(g(n))∧w(g(n)) is empty set.




BlueSky2008 2003-09-15
  • 打赏
  • 举报
回复
第一题其实就是证明定理:
f(n) = θ(g(n)) <=> f(n) = O(g(n)) .AND. f(n) = Ω(g(n))

充分性就不证了,必要性:
f(n) = O(g(n)) <=>
.EXIST. c1>0,N1>0 : .ANY. n>N1,0<=f(n)<=c1*g(n);

f(n) = Ω(g(n)) <=>
.EXIST. c2>0,N2>0 : .ANY. n>N2,0<=c2*g(n)<=f(n);

=>

.EXIST. c1>0,c2>0,N=max(N1,N2) : .ANY. n>N,0<=c2*g(n)<=f(n)<=c1*g(n);

<=>f(n) = θ(g(n))


2.Suppose it is not empty set,
=>
.EXIST. f(n): f(n) = o(g(n)) .AND. f(n) = w(g(n))
=>
.EXIST.N1: .ANY. c>0,n>N1,0<=f(n)<c*g(n)
.AND.
.EXIST.N2: .ANY. c>0,n>N2,0<=c*g(n)<f(n)

specially,let c=1,n0=max(N1,N2)+1,
=> f(n0)<g(n0) .AND. f(n0)>g(n0)
conflict!

33,008

社区成员

发帖
与我相关
我的任务
社区描述
数据结构与算法相关内容讨论专区
社区管理员
  • 数据结构与算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧