- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
[电脑基础知识]Ch10 ALGORITHM DESIGN TECHNIQUES数据结构外文版
* CHAPTER 10 ALGORITHM DESIGN TECHNIQUES §1 Greedy Algorithms ? Optimization Problems: Given a set of constrains and an optimization function. Solutions that satisfy the constrains are called feasible solutions. A feasible solution for which the optimization function has the best possible value is called an optimal solution. ? The Greedy Method: Make the best decision at each stage, under some greedy criterion. A decision made in one stage is not changed in a later stage, so each decision should assure feasibility. §1 Greedy Algorithms Note: Greedy algorithm works only if the local optimum is equal to the global optimum. Greedy algorithm does not guarantee optimal solutions. However, it generally produces solutions that are very close in value (heuristics) to the optimal, and hence is intuitively appealing when finding the optimal solution takes too much time. 1. A Simple Scheduling Problem Given N jobs j1 , j2 , …, jN , their running times t1 , t2 , …, tN , and one processor. Schedule jobs to minimize the average completion time. /* assume nonpreemptive scheduling */ ? The Single Processor Case §1 Greedy Algorithms 〖Example〗 job time j1 j2 j3 j4 15 8 3 10 Schedule 1 j1 0 15 j2 23 j3 26 j4 36 Tavg = ( 15 + 23 + 26 + 36 ) / 4 = 25 Schedule 2 j1 36 j2 11 0 j3 3 j4 21 Tavg = ( 3 + 11 + 21 + 36 ) / 4 = 17.75 In general: 0 ji1 ti1 ji2 ti1 + ti2 ji3 ti1 + ti2 + ti3 … … Best scheduling is to make { tik } nondecreasing. §1 Greedy Algorithms ? The Multiprocessor Case – N jobs on P processors 〖Example〗 P = 3 job time j1 j2 j3 j4 3 5 6 10 j5 j6 j7 j8 11 14 15 18 j9 20 An Optimal Solution j1 3 j2 5 j3 6 0 j4 13 j5 16 j6 20 j7 28 j8 34 j9 40 Another Optimal Solution j1 3 j2 5 j3 6 0 j4 15 j5 14 j6 20 j7 30 j8 38 j9 34 ? Minimizing the Final Completion Time NP Hard An Optimal Solution j1 3 j2 5 j3 9 j4 19 j5 16 j6 14 j7 j8 34 j9 0 §1 Greedy Algorithms 2. Huffman Codes – for file compression 〖Example〗 Suppose our text is a string of
您可能关注的文档
最近下载
- 【交通运输类】浙江省汽车维修行业工时定额和收费标准浙江省交通厅浙江省物价局精编.pdf VIP
- TD-JZ2006-6001西南设计院预埋件图集.pdf
- 01J925 1 压型板屋面.PDF VIP
- 视听语言 镜头运动.pptx VIP
- 广州市白云区广大附中实验中学2022-2023学年上学期期中调研八年级物理问卷.docx VIP
- JB∕T 5317-2016 环链电动葫芦.pdf VIP
- 广东省广州市白云区广大附中实验中学2022-2023学年八年级上学期期末线上考试语文试卷.doc VIP
- 风电机组专项隐患排查治理记录表.doc VIP
- 风电机组专项隐患排查治理记录表自查.pdf VIP
- 工厂生产管理制度(3篇).docx VIP
文档评论(0)