Download presentation
Presentation is loading. Please wait.
Published byCameron Patterson Modified over 9 years ago
1
0 Course Outline n Introduction and Algorithm Analysis (Ch. 2) n Hash Tables: dictionary data structure (Ch. 5) n Heaps: priority queue data structures (Ch. 6) n Balanced Search Trees: general search structures (Ch. 4.1-4.5) n Union-Find data structure (Ch. 8.1–8.5) n Graphs: Representations and basic algorithms Topological Sort (Ch. 9.1-9.2) Minimum spanning trees (Ch. 9.5) Shortest-path algorithms (Ch. 9.3.2) n B-Trees: External-Memory data structures (Ch. 4.7) n kD-Trees: Multi-Dimensional data structures (Ch. 12.6) n Misc.: Streaming data, randomization
2
1 Minimum spanning tree Connected, undirected graph with weights on edges Spanning tree: connected, hits all nodes, has no cycles MST = spanning tree of minimum total edge weight 4 2 10 3 1 7 2 5 1 8 4 6 2 1 2 1 4 6 weight of tree = 16
3
2 Cut theorem For any cut in the graph, the lowest-weight edge crossing the cut is in a MST. (If ties, each lowest-weight edge is in some MST) “Greed works.” 4 2 10 3 1 7 2 5 1 8 4 6 2 1 2 1 4 6
4
3 Prim ’ s algorithm 4 2 10 3 1 7 2 5 1 8 4 6 2 1 2 1 4 6 T = one vertex, no edges for i = 1 to n-1 add the cheapest edge joining T to another vertex very similar to Dijkstra ’ s shortest-path algorithm n implementation: priority queue (binary heap) of edges from known to unknown vertices n time: O( |E| log |V| )
5
4 Kruskal ’ s algorithm 4 2 10 3 1 7 2 5 1 8 4 6 2 1 2 1 4 6 for i = 1 to n-1 add the cheapest edge that doesn ’ t create a cycle n implementation: priority queue (binary heap) of all edges n disjoint set union to detect cycles n time: O( |E| log |V| )
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.