- 1、本文档共64页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
复杂性分析 * 递推关系式 T(n)=O(nlogn) Thanks! * Choosing the pivot 1. Divide the n elements into groups of 5. Choosing the pivot 2. Find the median of each 5-element group. Choosing the pivot Choosing the pivot Choosing the pivot Choosing the pivot Minor simplification Analysis of Alg. SELECT Running Time T(n)= Θ (n) Conclusions Since the work at each level of recursion is a constant fraction (19/20) smaller, the work per level is a geometric series dominated by the linear work at the root. In practice, this algorithm runs slowly, because the constant in front of n is large. The randomized algorithm is far more practical. * 5 大整数乘法(Large Integer Multiplication) Complex multiplication. (a + bi) (c + di) = x + yi. Grade-school. x = ac - bd, y = bc + ad. Gauss method. x = ac - bd, y = (a + b) (c + d) - ac - bd. Remark. Improvement if no hardware multiply. 4 ultiplications, 2 additions 3 multiplications, 5 additions * Integer Arithmetic Add. Given two n-bit integers a and b, compute a + b. Grade-school. Θ(n) bit operations. Multiply. Given two n-bit integers a and b, compute a * b. Grade-school. Θ(n2) bit operations. * Multiply two n-bit integers x = (10ma +b), y = (10mc +d), m=n/2 x y = (10ma +b) (10mc +d) Example: x = 1234567890, m=5, a=12345, b=67890 Multiply four n/2-bit integers. ac, bc, ad, bd Add and shift to obtain result. x y = 102mac + 10m(bc +ad)+ bd * 分治算法伪代码 Alg. Multiply (x, y, n) If n = 1 return x*y; Else m = n/2; a = x/10m, b = x mod 10m; c = y/10m, d= y mod 10m; e = Multiply(a, c,m); f = Multiply(b, d, m); g = Multiply(b, c, m); h = Multiply(a, d, m); Reutrn 102m*e + 10m* (g+h) +f; * Running Time of Alg. Multiply T(n) = 4T(n/2) + O(n) T(1) = 1 Which solves to T(n) = O(n2) by the master theorem. Fast multiply: Anatolii, Karatsuba in 1962: x y = 102mac + 10m(bc +ad)+ bd T(n) = 3 T(n/2) + O(n) T(n) = O(nlg3)=O(n1.585) bc + ad = ac+ bd - (a - b
您可能关注的文档
- 国家基本公共卫生服务规范-健康教育服务规范培训选编.ppt
- 【师说】2016高考化学(人教)探索.ppt
- 2016第二学期统练20160301探索.docx
- 2016第十七届中国(武汉)国际美食文化节01探索.pptx
- 2016鄂教版五年级心理健康全册探索.docx
- 2016尔雅《公共关系礼仪实务》期末考试探索.docx
- 2016尔雅公共关系礼仪实物题库课后习题探索.docx
- 2016尔雅网络课《美术鉴赏》期末考试(新)探索.docx
- 2第二章紫外可见光谱和荧光光谱探索.ppt
- 2016二级建造师《市政工程》真题及探索.docx
- 《钢铁是怎样炼成》名著阅读练习题含答案知识梳理.docx
- 2025年上半年三级安全教育考试卷(含答案)【推荐】.docx
- 2025年政工师考试试题(+答案)【推荐】.docx
- 2025年宁波市江东区小升初数学秋季入学摸底测试卷(含答案).doc
- 2025初级会计师《经济法基础》试题及答案(新版)【推荐】.docx
- 2025年贵州二级建造师执业资格考试试题【推荐】.docx
- 2025年主管护师考试考试测试题(+答案)-专业知识.docx
- 最新《京剧欣赏》阅读测试题(含答案).docx
- 2025年宁波市奉化市小升初数学秋季入学摸底测试卷(含答案).doc
- 2025至2030年中国双扑伪麻片行业发展趋势及投资前景预测报告.docx
最近下载
- 诸侯纷争与变法运动【课件】.pptx VIP
- 中国高血压防治指南(2024年修订版)_中国高血压防治指南修订委员会__.pdf VIP
- “扬子石化杯”2024年第38届中国化学奥林匹克(江苏赛区)初赛化学.pdf VIP
- 民事诉讼法中案外第三人对执行的异议之诉.pdf VIP
- 车险承保方案.pdf VIP
- “扬子石化杯”2024年第38届中国化学奥林匹克(江苏赛区)初赛化学试卷含答案.pdf VIP
- 临海市城市生活垃圾焚烧发电厂扩建工程环境影响报告.pdf
- 2025内蒙古鄂尔多斯市公安机关招聘留置看护警务辅助人员115人笔试参考题库附答案解析.docx VIP
- 模电教案-李国丽.doc
- 2023版中国结直肠癌及癌前病变内镜诊治共识PPT课件.pptx VIP
文档评论(0)