Let4-Recurrences.ppt

  1. 1、本文档共27页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Let4-Recurrences

Simple Review Merge Sort MERGE(A,p,q,r) Analysis of Merge Sort-Θ(nlgn), by Picture of Recursion Tree Telescoping Mathematical Induction Asymptotic Growth O-notation Ω-notation Θ-notation Simple Review Merge Sort MERGE(A,p,q,r) Analysis of Merge Sort-Θ(nlgn), by Picture of Recursion Tree Telescoping Mathematical Induction Asymptotic Growth O-notation Ω-notation Θ-notation Design and Analysis of Algorithms Recurrences(Ch4) Three common cases Compare f(n) with nlogba : 1. f(n) = O(nlogba -ε) for some constantε 0 f(n) grows polynomially slower than nlogba (by an nε factor), Solution: T(n) = Θ(nlogba) 2. f(n) = Θ(nlogbalgkn) for some constant k≥ 0 f(n) and nlogba grow at similar rates, Solution: T(n) = Θ(nlogbalgk+1n) 3. f(n) = Ω((nlogba+ε) for some constantε 0 f(n) grows polynomially faster than nlogba (by an nε factor), and f(n) satisfies the regularity condition that af(n/b) ≤cf(n) for some constant c 1 Solution: T(n) = Θ(f(n)) Master theorem - examples T(n)=9T(n/3)+n a=9, b=3, f(n) = n logba = 2, f(n) = O(nlogba –ε) where ε=1, case 1 T(n) = Θ(nlogba) =Θ(n2) T(n)=T(2n/3)+1 a=1, b=3/2, f(n) = 1 logba = 0, f(n) = Θ(nlogbalgkn) where k = 0, case 2 T(n) = Θ(nlogbalgk+1n) =Θ(lgn) T(n)=3T(n/4)+nlgn a=3, b=4, f(n) = nlgn logba = log43≈0.793, f(n) = Ω(nlogba –ε) where ε≈ 0.2 af(n/b) = 3f(n/4) = 3(n/4)lg(n/4)≤(3/4)nlgn = cf(n) where c = 3/4, case 3 T(n) = Θ(f(n)) =Θ(nlgn) Homework 4.1-1,4.1-6,4.2-1,4.3-2,4.3-3 *Software School of XiDian University *Software School of XiDian University Θ-notation Note: --Similarly, f(n) = Θ(g(n)) corresponds to f(n) = g(n) --We often think of f(n) = O(g(n)) as corresponding to f(n)≤g(n). --Similarly, f(n) = Ω(g(n)) corresponds to f(n) ≥ g(n) Asymptotic Notation in Equations For example, 4n3 + 3n2 + 2n + 1 = 4n3 + 3n2 + Θ(n) = 4n3 + Θ(n2) = Θ(n3) Used to replace functions of lower-order terms to simplify equations/expressions. Or we can do the following: 4n3 + 3n2 + 2n + 1 = 4n3 + f(n2) Wher

您可能关注的文档

文档评论(0)

cj80011 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档