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

算法课件全121301ADA14动态规划二项式系数与全源最短路径

37页
  • 卖家[上传人]:E****
  • 文档编号:91095439
  • 上传时间:2019-06-21
  • 文档格式:PPT
  • 文档大小:494.50KB
  • / 37 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 1、Dynamic Programming (1),Chapter 8,Basic Idea and Framework of DP Application to Non-optimization Problem Binomial Coefficient Calculation Application to optimization Problem,2019/6/21,3,2012-2013-01 Design and Analysis of Algorithm SCUN,Goals of This Lecture,At the end of this lecture, you should Master the basic idea of dynamic programming and know the difference between DP and DAC Master the binomial coefficient calculation algorithm Master the basic idea of Floyds algorithm for all-pairs shor

      2、test paths problem and analyze the time complexity of Floyds algorithm Master how to get the transitive closure of a digraph,2019/6/21,4,2012-2013-01 Design and Analysis of Algorithm SCUN,Dynamic Programming,Dynamic Programming is a general algorithm design technique for solving problems defined by recurrences with overlapping subproblems. Invented by American mathematician Richard Bellman in the 1950s to solve optimization problems. “Programming” here means “planning”,2019/6/21,5,2012-2013-01 D

      3、esign and Analysis of Algorithm SCUN,Binomial Coefficient,This can also be expressed as:,Binomial coefficients are coefficients of the binomial formula:(a + b)n = C(n,0)anb0 + . . . + C(n,k)an-kbk + . . . + C(n,n)a0bn,The equation for the binomial coefficient is:,2019/6/21,6,2012-2013-01 Design and Analysis of Algorithm SCUN,Binomial Coefficient,It also shows us how we could use an array to calculate these values,This second form shows us we could set up a recursive algorithm to calculate the bi

      4、nomial coefficient,2019/6/21,7,2012-2013-01 Design and Analysis of Algorithm SCUN,Binomial Coefficient Algorithm,BinomialCoefficient(N,k) /Imput: A pair of nonnegative integers nk0 /Output: The value of C(n,k) for i 0 to n do for j 0 to min (i, k) do if j = 0 or j = i Ci, j 1 else C i, j = C i-1, j-1 + Ci-1, j return Cn,k,Space efficiency: (Nk),Time efficiency: (Nk),Key ingredients of an optimization problem be suitable solved by DP Basic idea of DP for solving optimization problem Application t

      5、o Graph problem All-pairs shortest-path problem Transitive closure problem Application to Numerical Problem Matrix Chain Multiplication Problem Application to Combinatorial Problem Knapsack Problem,Application of DP to optimization problem,2019/6/21,9,2012-2013-01 Design and Analysis of Algorithm SCUN,Two key ingredients,An optimization problem be suitable solved by DP must have two key ingredients:,2019/6/21,10,2012-2013-01 Design and Analysis of Algorithm SCUN,Four steps and Three components,B

      6、asic idea of DP for solving optimization problem can be divided into 4 steps Characterize the structure of an optimal solution Recursively define the value of an optimal solution Compute the value of an optimal solution in a bottom-up fashion Construct an optimal solution from computed information The development of a dynamic programming algorithm has three basic components A recurrence relation (for defining the value/cost of an optimal solution); A tabular computation (for computing the value

      7、of an optimal solution); A backtracing procedure (for delivering an optimal solution).,2019/6/21,11,2012-2013-01 Design and Analysis of Algorithm SCUN,All Pairs Shortest-Paths Problem,Input: A directed graph G = (V, E), and a weight function w: E R. Output: A shortest path for each pair of vertices u and v in V, if it exists. We output: a V V matrix D = (dij), where, dij contains the weight of a shortest path from vertex i to vertex j; and V V matrix = (ij), where ij means the predecessor of j i

      8、n a shortest path from vertex i to vertex j.,2019/6/21,12,2012-2013-01 Design and Analysis of Algorithm SCUN,Characterize the structure of the optimal solution,If i, v1, v2 , vk-1, vk, vk+1, , j is the shortest path from i to j, then i, v1, v2, , vk-1, vk and vk, vk+1, , j must be the shortest paths from i to vk and vk to j respectively.,2019/6/21,13,2012-2013-01 Design and Analysis of Algorithm SCUN,Define the Recurrence Relation,. :,. :,k-1,i,j,1,2,k,k+1,n,2019/6/21,14,2012-2013-01 Design and

      9、Analysis of Algorithm SCUN,Solve the problem stage by stage (dynamic programming): D(0), D(1), D(2), , D(n) where D(k) contains the shortest path weight with all the intermediate vertices from set 1,2,k. dij(k): shortest path weight from i to j with intermediate vertices (excluding i, j) in the set 1, 2, , k dij(0) = wij (no intermediate vertices at all) Result: D(n) = (dij(n) = (i, j) (because all intermediate vertices are in the set 1, 2, , n),Define the Recurrence Relation,2019/6/21,15,2012-2013-01 Design and Analysis of Algorithm SCUN,dij(0) = wij if k=0 dij(k) = min(dij(k-1), dik(k-1) + dkj(k-1) if k 1,Define the Recurrence Relation,2019/6/21,16,2012-2013-01 Design and Analysis of Algorithm SCUN,Constructing a shortest path,For k=1,For k=0,2019/6/21,17,2012-2013-01 Design and Analysis of Algorithm SCUN,Floyd algorithm (Example),k=0: d41(0)=2; d42(0)=; d43(0)

      《算法课件全121301ADA14动态规划二项式系数与全源最短路径》由会员E****分享,可在线阅读,更多相关《算法课件全121301ADA14动态规划二项式系数与全源最短路径》请在金锄头文库上搜索。

      点击阅读更多内容
    最新标签
    发车时刻表 长途客运 入党志愿书填写模板精品 庆祝建党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.