Chapter5算法概论概要1.ppt

Chapter5算法概论概要1

5.4 Set cover Claim: Suppose B contains n elements and that the optimal cover consists of k sets. Then the greedy algorithm will use at most klnn sets. Approximation factor: the ratio between the optimal value of the approximation solution and that of the optimal solution. The closer the approximation factor is to one, the better the greedy algorithm performs. * * 5.4 Set cover Proof * * Exercise 5.3 * * Exercise 5.5 * * 4 Exercise 5.7 * * Exercise 5.14 * * Exercise 5.15 * * Exercise 5.16 * * Exercise 5.16 * * Earlier merge! nodes Exercise 5.17 * * Exercise 5.28 * * O(V+O(E)) O(V2+E)=O(V2) Exercise 5.31 * * EXERCISE 5.32 * * i-1 Homework: Ex 5.17, 5.32 submit in the next lesson, please. * * Exercise 5.17 * * EXERCISE 5.32 * * EXERCISE 5.32 * * CHAPTER 5 Greedy algorithms 5.1 Minimum spanning trees 5.2 Huffman encoding 5.3 Horn formulas 5.4 Set cover * * 5.1 Minimum spanning trees Introductory example: how to find the cheapest network? Property 1 Removing a cycle edge cannot disconnect a graph. The solution: A tree (connected and acyclic) The minimum spanning tree (with minimum total weight) * * 5.1 Minimum spanning trees Minimum spanning tree (MST) Input: An undirected graph G=(V,E); edge weights We. Output: A tree T=(V,E’), with E’?E, that minimizes * * The MST is not unique! 5.1.1 A greedy approach Kruskal’s MST algorithm: Start with the empty graph Repeatedly add the next lightest edge that doesn’t produce a cycle Example: Add edges in increasing order of weight * * 5.1.1 A greedy approach Trees Property 1 A tree on n nodes has n-1 edges. Property 2 Any connected, undirected graph G=(V,E) with |E|=|V|-1 is a tree. Property 3 An undirected graph is a tree if and only if there is a unique path between any pair of nodes * * 5.1.2 The cut property The correctness of Kruskal’s method follows from a cut property. Cut: any partition of the vertices into two groups: S and V-S. Cut property: Suppose edges X are part of a minimum spanning t

文档评论(0)

1亿VIP精品文档

相关文档