- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
2007-2008-01《Design and Analysis of Algorithms》SCUEC Goals of the Lecture At the end of this lecture, you should Understand what’s selection problem and master the partition based algorithm for finding the kth smallest elements Master the basic idea of interpolation search and know the differences between binary search and interpolation search Know how to solve the game of nim Selection Problem What’s selection problem? Find the kth element (direct idea) To find the kth smallest element, we could move the k smallest elements to the start of the list and then the kth smallest will be in location list[k] This involves finding the smallest element and moving it to the first place, then finding the second smallest element and moving it to the second place and so on Direct Idea Algorithm Direct Idea Algorithm Analysis We need to do k passes, thus giving Algorithms based on Variable-Size-Decrease Technique A faster algorithm is based on using the quicksort-like partition of the list. Let s be a split position obtained by a partition: Assuming that the list is indexed from 1 to n: If s = k, the problem is solved; if s k, look for the k-th smallest elem. in the left part; if s k, look for the (k-s)th smallest elem. in the right part. Tracing the Median / Selection Algorithm Example: 4 1 10 9 7 12 8 2 15 Here: n = 9, k = ?9/2? = 5 array index 1 2 3 4 5 6 7 8 9 4 1 10 9 7 12 8 2 15 4 1 2 9 7 12 8 10 15 2 1 4 9 7 12 8 10 15 --- s=3 k=5 9 7 12 8 10 15 9 7 8 12 10 15 8 7 9 12 10 15 --- s=6 k=5 8 7 7 8 --- s=k=5 Algorithms based on variable-size-decrease technique Fi
您可能关注的文档
- 简单几何体简单几何体体1章节.ppt
- 高中生物选修一果胶酶在果汁生产中的应用.ppt
- 简单几何体柱体锥体台体的表面积.ppt
- 简谐振动简谐振动旋转矢量振动能量课件.ppt
- 简医疗卫生服务成本测算.ppt
- 黑板“跑了”.ppt
- 简约论坛,吕柏邑.ppt
- 黑板“跑了”课件1章节.ppt
- 黑板跑了1章节.ppt
- 黑板跑了3章节.ppt
- 学前教育心理学2022年4月历年真题及答案.docx
- 学前教育心理学模拟题一及答案.docx
- 学前教育心理学 2023年4月历年真题及答案.docx
- 学前教育心理学 2024年4月历年真题及答案.docx
- 苏教版五年级下册《认识方程与等式》.ppt
- Unit1 Our school subjects(教案)-2023-2024学年译林版(三起)英语四年级下册.docx
- 简明电路分析基础04b戴维南定理诺顿定理.pptx
- 统编版2025小学五年级语文上册第三单元综合素养能力提升测评试卷(A3版)(附答案).docx
- 2025-2026学年第一学期“青蓝携手·师道传承”师徒结对实施方案.docx
- 统编版2025小学五年级语文上册第四单元综合拓展培优提升测评试卷(A3版)(附答案).docx
文档评论(0)