- 1
- 0
- 约 53页
- 2017-05-31 发布于新疆
- 举报
計算式樹的計算 以後序追蹤計算式樹,請寫下結果。 - * 5 3 / + 6 2 4 圖形(Graph) 圖形(Graph)是指以邊(Edge)將節點(node, Vertex)連接起來的物件。 G=(V, E) V = vertex set E = edge set 圖形表示法: Adjacency list Adjacency matrix Undirected Graph Directed Graph 圖形的搜尋 Breadth-first search (BFS) Depth-first search (DFS) Topological sort Strongly connected components 無向圖(undirected Graph)表示法 有向圖(directed Graph)表示法 Breadth-First Search (BFS) Depth-first search (DFS) 拓樸排序(Topological sort) 拓樸排序是指以某種規則將一有向圖形連接的節點排列成一列的情形。 方法不是唯一。 1 2 4 5 6 8 7 3 Euler的一筆畫 1736年,尤拉發表了他的「一筆劃定理」,大致如下:? ? 一個圖形要能一筆劃完成必須符合兩個狀況:? ? 1. 圖形是封閉連通的;? ? 2. 圖形中的奇點個數為0或2。 Spanning Tree(展開樹) A spanning tree of a graph is just a subgraph that contains all the vertices and is a tree. A graph may have many spanning trees; for instance the complete graph on four vertices Minimum spanning tree The weight of a tree is just the sum of weights of its edges. Lemma: Let X be any subset of the vertices of G, and let edge e be the smallest edge connecting X to G-X. Then e is part of the minimum spanning tree. Kruskals algorithm 最易理解,也最易以手算的方法。 Kruskals algorithm: sort the edges of G in increasing order by length keep a subgraph S of G, initially empty for each edge e in sorted order if the endpoints of e are disconnected in S add e to S return S 這是一個Greedy method (貪心演算法) 那個邊(edge)存在於下圖的最小成本生成樹(minimum-cost spanning trees)中? (a)AB (b)CD (c)CE (d)EF Sort: 5,6,10,12,15,18,21,24,25,30 A E D B C F 5 12 15 6 10 18 25 21 24 30 Minimum cost = 5+6+12+18+24 = 65 Minimum cost spanning tree 下圖中的最小成本擴張樹(Minimum cost spanning tree)的成本為 (a)17 (b)20 (c)22 (d)14 最短路徑(Shortest Path) 最短路徑(Shortest Path) 最短路徑(Shortest Path) 最短路徑(Shortest Path) 排序(sort) 直接選擇法(基本選擇法)O(n2) 泡泡排序法(基本交換法)O(n2) 快速排序法(改良交換法)O(nlog2n) Heap 排序(改良選擇法)O(nlog2n) 合併排序(Merge sort) O(nlog2n) Shell 排序(改良插入法)O(n1.2) Merge Sort Definition: A sort algorithm that splits the items to be sorted into two groups, recursively sorts each group, and merges them into a final, sorted sequence. Run t
您可能关注的文档
- 大学英语口语教程 Disaster.ppt
- 大学英语口语教程 ETIQUETTE & MANNERS.ppt
- 大学英语口语教程 Job Interview.ppt
- 大学英语口语教程 the Meaning of Life.ppt
- 导游业务知识+++.ppt
- 地理总复习--城市与人口.ppt
- 地震学概论总复习+.ppt
- 电路总复习++.ppt
- 多媒体技术概论课程总复习+.ppt
- 翻译第二讲 翻译的过程4.ppt
- 2025年版汽车趋势报告 The 2025 EPA Automotive Trends Report.docx
- 2026年边缘计算开源平台EdgeX Foundry入门与二次开发.docx
- 2026年超声内镜放大内镜早癌诊断AI辅助识别系统临床评价.docx
- 2026年报废汽车回收与再制造逆向物流体系.docx
- 2026年产品碳足迹核算方法学:从摇篮到大门与从摇篮到坟墓.docx
- 2026年城乡要素平等交换双向流动政策创新试点申报材料.docx
- 2026年超导半导体接口电路架构与电平转换驱动器设计.docx
- 2026年财政贴息不再以再贷款支持为前提后的风险防范与合规要点.docx
- 2026年不动产信托登记试点政策对遗嘱信托支持.docx
- 2026年城乡有机废弃物协同处理技术方案.docx
原创力文档

文档评论(0)