[PPT模板]The Divide-and-Conquer Strategy.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 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

文档评论(0)

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

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

1亿VIP精品文档

相关文档