电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

算法课件全121301ADA03算法分析基础-递归与非递归算法的分析方法

25页
  • 卖家[上传人]:E****
  • 文档编号:91095431
  • 上传时间:2019-06-21
  • 文档格式:PPT
  • 文档大小:593KB
  • / 25 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 1、2019/6/21,2,2012-2013-01Design and Analysis of Algorithm SCUN,Review of last class,Methods for describing algorithm The framework for analyzing the time efficiency of an algorithm The best-case, worst-case and average-case analysis Rate of growth and two asymptotic notations , O,Fundamentals of the Analysis of Algorithm Efficiency (II),Chapter 2,1、 Formal definition of asymptotic notations 2、 Mathematical Background 3、 Analysis of non-recursive algorithms,2019/6/21,4,2012-2013-01Design and Analy

      2、sis of Algorithm SCUN,Goals of this lecture,At the end of this lecture, you should Master asymptotic notations Be familial with the basic mathematical tools Master the analysis of non-recursive algorithms,2019/6/21,5,2012-2013-01Design and Analysis of Algorithm SCUN,Asymptotic Notation: ,-notation: Call f(n) = (g(n) if there exist positive constants c1, c2, and n0 such that 0 c1g(n) f(n) c2g(n) for all n n0. f(n) = 2n3+3n-5 = (n3) f(n) = 2n4+1 = (n3) ?,2019/6/21,6,2012-2013-01Design and Analysis

      3、 of Algorithm SCUN,Asymptotic Notation: ,f(n) = (g(n),n,f(n),c2g(n),n0,c1g(n),2019/6/21,7,2012-2013-01Design and Analysis of Algorithm SCUN,Using Limits for Comparing Orders of Growth,A much more convenient method for comparing the orders of growth of two specific functions is based on computing the limit of the ratio of two functions:,The first two cases, say , mean that f(n) O(g(n),The last two cases, say , mean that f(n) (g(n),The second cases, say , mean that f(n) (g(n),Compare the orders of

      4、 growth of logn and,Compare the orders of growth of n! and 2n,Compare the orders of growth of 1/2n(n-1) and n2,2019/6/21,8,2012-2013-01Design and Analysis of Algorithm SCUN,Orders of growth of some important functions,All logarithmic functions loga n belong to the same class (log n) no matter what the logarithms base a 1 is All polynomials of the same degree k belong to the same class: aknk + ak-1nk-1 + + a0 (nk) Exponential functions an have different orders of growth for different as,2019/6/21

      5、,9,2012-2013-01Design and Analysis of Algorithm SCUN,Asymptotic Notation: o,o-notation Call f(n) = o(g(n) if there exist positive constants c and n0 such that f(n) cg(n) for all n n0. Or, if , then f(n) = o(g(n) f(n) = 2n3+3n-5 = o(n4) f(n) = o(g(n) if and only if f(n) = O(g(n) , but g(n) O(f(n) nlogn = o(n2) means that nlogn = O(n2), but n2 O(nlogn),2019/6/21,10,2012-2013-01Design and Analysis of Algorithm SCUN,Asymptotic Notation,Using the o-notation, we can concisely express the following hie

      6、rarchy of complexity classes. Polynomial complexity classes: 11) n! nn,2019/6/21,11,2012-2013-01Design and Analysis of Algorithm SCUN,Basic asymptotic efficiency classes,2019/6/21,12,2012-2013-01Design and Analysis of Algorithm SCUN,Mathematical Background,Proof methods Floor and ceiling functions Summations Recurrence relations,2019/6/21,13,2012-2013-01Design and Analysis of Algorithm SCUN,Proof methods,Direct proof If n is an even integer, then n2 is an even integer. Indirect proof If n2 is an

      7、 even integer, then n is an even integer. Proof by counterexample Let f(n)=n2+n+41 be a function defined on the set of nonnegative integers, proof f(n) is always a prime number. Proof by contradiction There are infinitely many primes.,2019/6/21,14,2012-2013-01Design and Analysis of Algorithm SCUN,Proof methods (cont.),Mathematical induction Claim: S(n) is true for all n = k Basis: Show formula is true when n = k Inductive hypothesis: Assume formula is true for an arbitrary n-1 Inductive Step: Sh

      8、ow that formula is then true for n Example Proof (1+x)n1+nx for every real number x-1 and for every natural number n.,2019/6/21,15,2012-2013-01Design and Analysis of Algorithm SCUN,Floor and ceiling functions,x: the floor of x, is the largest integer to x x: the ceiling of x, is the smallest integer to x Example: 3.5 = 3, -3.5 = -4 3.5 = 4, -3.5 = -3 Note: -x = - x, -x = - x , x/2 + x/2 =x log(n+1) = logn +1,Theorem: Let f(x) be monotonically increasing function such that if f(x) is integer, the

      9、n x is integer. Then, f(x)= f(x) and f(x)= f(x),2019/6/21,16,2012-2013-01Design and Analysis of Algorithm SCUN,Plan for Analysis of Nonrecursive Algorithms,Decide on a parameter indicating an inputs size. Identify the algorithms basic operation. Check whether the number of times the basic op. is executed may vary on different inputs of the same size. (If it may, the worst, average, and best cases must be investigated separately.) Set up a sum expressing the number of times the algorithms basic operation is executed. Using standard formulas and rules of sum manipulation, either find a closed form formula for the count or, at very least, establish its order of growth.,2019/6/21,17,2012-2013-01Design and Analysis of Algorithm SCUN,Summations,A summation is a com

      《算法课件全121301ADA03算法分析基础-递归与非递归算法的分析方法》由会员E****分享,可在线阅读,更多相关《算法课件全121301ADA03算法分析基础-递归与非递归算法的分析方法》请在金锄头文库上搜索。

      点击阅读更多内容
    最新标签
    发车时刻表 长途客运 入党志愿书填写模板精品 庆祝建党101周年多体裁诗歌朗诵素材汇编10篇唯一微庆祝 智能家居系统本科论文 心得感悟 雁楠中学 20230513224122 2022 公安主题党日 部编版四年级第三单元综合性学习课件 机关事务中心2022年全面依法治区工作总结及来年工作安排 入党积极分子自我推荐 世界水日ppt 关于构建更高水平的全民健身公共服务体系的意见 空气单元分析 哈里德课件 2022年乡村振兴驻村工作计划 空气教材分析 五年级下册科学教材分析 退役军人事务局季度工作总结 集装箱房合同 2021年财务报表 2022年继续教育公需课 2022年公需课 2022年日历每月一张 名词性从句在写作中的应用 局域网技术与局域网组建 施工网格 薪资体系 运维实施方案 硫酸安全技术 柔韧训练 既有居住建筑节能改造技术规程 建筑工地疫情防控 大型工程技术风险 磷酸二氢钾 2022年小学三年级语文下册教学总结例文 少儿美术-小花 2022年环保倡议书模板六篇 2022年监理辞职报告精选 2022年畅想未来记叙文精品 企业信息化建设与管理课程实验指导书范本 草房子读后感-第1篇 小数乘整数教学PPT课件人教版五年级数学上册 2022年教师个人工作计划范本-工作计划 国学小名士经典诵读电视大赛观后感诵读经典传承美德 医疗质量管理制度 2 2022年小学体育教师学期工作总结 2022年家长会心得体会集合15篇
    关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
    手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
    ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.