- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
[PPT模板]The Divide-and-Conquer Strategy
Data Compression and Multimedia Communication Lab. Divide-and-Conquer strategy Chapter 5 The Divide-and-Conquer Strategy Split the original problem into two subproblems Recursive solve these two subproblems by applying the divide- and-conquer strategy Merge the solutions of the two subproblems into a solution of the original problem Basic technique of Parallel programming Correctness is easily established Analysis is relatively easy T(n)=2T(n/2)+S(n)+M(n) n?c =b nc S(n):Split time M(n):Merge time b:the time to compute the answer directly for small inputs The Divide-and-Conquer Strategy E.g. find the maximum of a set S of n numbers The Divide-and-Conquer Strategy Time complexity: Assume n = 2k, T(n) = 2T(n/2)+1 = 2(2T(n/4)+1)+1 = 4T(n/4)+2+1 : =2k-1T(2)+2k-2+…+4+2+1 =2k-1+2k-2+…+4+2+1 =2k-1 = n-1 = O(n) A general divide-and-conquer algorithm Step 1: If the problem size is small, solve this problem directly; otherwise, split the original problem into 2 sub-problems with equal sizes. Step 2: Recursively solve these 2 sub-problems by applying this algorithm. Step 3: Merge the solutions of the 2 sub-problems into a solution of the original problem. A general divide-and-conquer algorithm Time complexity: where S(n) : time for splitting M(n) : time for merging b : a constant c : a constant quick sort – divide and conquer E.g. 29 14 15 1 6 10 32 12 S(n)=O(n) M(n)=1 Worst case: O(n2) Average case: O(nlogn) Best case: O(nlogn) Divide - equal size of two subproblems medium - O(n) (Prune-and-Search) merge sort – divide and conquer E.g. 29 14 15 1 6 10 32 12 S(n)=1 M(n)=O(n) T(n)=2T(n/2)+O(n)=O(nlogn) 2-D maxima finding problem Def : A point (x1, y1) dominates (x2, y2) if x1 x2 and y1 y2. A point is called a maxima if no other point dominates it Straightforward method : Compare every pair of points Time compl
您可能关注的文档
最近下载
- 某尾矿溢水塔回水隧洞封堵工程施工方案.pdf VIP
- 婴幼儿的早期教育工作总结PPT.pptx VIP
- 【高考真题】重庆市2025年高考真题物理试卷(含答案).pdf VIP
- 教案对外汉语我是跟旅游团一起来的.pdf VIP
- 2024年秋季新教材人教版一年级上册数学全册教案-129页.docx VIP
- 2024-2025学年初中英语九年级上册牛津上海(试用本)教学设计合集.docx
- 2020年《城镇燃气设计规范》GB50028-2006 .pdf VIP
- T_CDHA 13-2023 热力管道用金属波纹管补偿器.pdf
- 燃气工程技术专业基础知识考试题库(含答案).docx VIP
- 室内滑雪馆消防设计探讨.pdf VIP
文档评论(0)