- 1、本文档共19页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
(MIT经典)算法设计与分析教学课件ch05
Design and Analysis of Algorithms - Chapter 5 Decrease and Conquer Reduce problem instance to smaller instance of the same problem and extend solution Solve smaller instance Extend solution of smaller instance to obtain solution to original problem Also referred to as inductive or incremental approach Examples of Decrease and Conquer Decrease by one: Insertion sort Graph search algorithms: DFS BFS Topological sorting Algorithms for generating permutations, subsets Decrease by a constant factor Binary search Fake-coin problems multiplication à la russe Josephus problem Variable-size decrease Euclid’s algorithm Selection by partition What’s the difference? Consider the problem of exponentiation: Compute an Brute Force: Divide and conquer: Decrease by one: Decrease by constant factor: Graph Traversal Many problems require processing all graph vertices in systematic fashion Graph traversal algorithms: Depth-first search Breadth-first search Depth-first search Explore graph always moving away from last visited vertex Similar to preorder tree traversals Pseudocode for Depth-first-search of graph G=(V,E) DFS(G) count :=0 mark each vertex with 0 (unvisited) for each vertex v∈ V do if v is marked with 0 dfs(v) dfs(v) count := count + 1 mark v with count for each vertex w adjacent to v do if w is marked with 0 dfs(w) Example – undirected graph Depth-first traversal: Types of edges Tree edges: edges comprising forest Back edges: edges to ancestor nodes Forward edges: edges to descendants (digraphs only) Cross edges: none of the above Example – directed graph Depth-first traversal: Depth-first search: Notes DFS can be implemented with graphs represented as: Adjacency matrices: Θ(V2) Adjacency linked lists: Θ(V+E) Yields two distinct ordering of vertices: preorder: as vertices are first encountered (pushed onto stack) postorder: as vertices become dead-ends (popped off stack) Applications: checking connectivity, finding connected components checkin
您可能关注的文档
- (2012年新版)人教新目标七年级英语下册《Unit6 I’m watching TV Section A》优秀课件.ppt
- (2012读者培训)全文文献获取的方法与期刊等级鉴别.ppt
- (2012年新版)《Unit6_I’m_watching_TV_Section_A》优秀课件.ppt
- (Antonymy) 反义词.ppt
- (C)2 水处理-2.ppt
- (Book 1)英语写作4-6单元(195页)(2012.12.20).ppt
- (2015年PPT模板)Conference Sample Slides.ppt
- (EndNote)journals list-5776文献 全称-缩写带点和不带点.docx
- (3.6)定稿公开课Unit 3 Under the sea-Reading26.ppt
- (EEC)五年级英语下册课件 Lesson1 What Would You Like to Eat.ppt
- 2025年长沙银行浏阳支行社会招聘考试备考题库及答案解析.docx
- 2025年浙商银行成都分行社会招聘考试备考题库及答案解析.docx
- 2025中国农业科学院烟草研究所高层次人才招聘5人考试备考题库及答案解析.docx
- 2025中国冶金地质总局二局 国冶二局(福建)集团有限公司招聘10人考试备考题库及答案解析.docx
- 2025中国宗教杂志社招聘3人考试备考题库及答案解析.docx
- 2025年长沙银行益阳支行社会招聘考试备考题库及答案解析.docx
- 2025中国农业科学院农田灌溉研究所第二批招聘14人(河南)考试备考题库及答案解析.docx
- 2025中国农业科学院郑州果树研究所青年英才招聘3人考试备考题库及答案解析.docx
- 【统编版】高中语文必修上册第1单元2.1《立在地球边上放号》精美课件(23张PPT).pptx
- 【统编版】高一语文必修上册第一单元2.1《立在地球边上放号》优质课(26张PPT)课件.pptx
最近下载
- 绿化养护方案(同名6533).doc VIP
- T∕ZZB 1894-2020 双平臂落地抱杆.pdf VIP
- (2024)反洗钱知识竞赛题库(含答案).pptx VIP
- 4-输电线路工程质量强制性条文执行记录表.doc VIP
- 回忆鲁迅先生教案.docx VIP
- 计算机日常使用维护培训ppt课件.pptx VIP
- GB50204-2015 《混凝土结构工程施工质量验收规范》GB50204-2015 (1).docx VIP
- 2025年4月20日四川省事业单位考试《公共基础知识》试题及答案解析参考.pdf
- 《2#空压机站施工组织设计》.doc
- 13J933-2 体育场地与设施(二).docx VIP
文档评论(0)