1 / 4

Tirgul 14

Tirgul 14. (and more) sample questions. (reminder?) Kruskal’s MST Algorithm. Q. Suppose that all edges weights in a graph are integers in the range of 1 to | V |. How fast can you make Kruskal’s algorithm run?

umika
Download Presentation

Tirgul 14

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tirgul 14 • (and more) • sample questions DAST 2005

  2. (reminder?)Kruskal’s MST Algorithm DAST 2005

  3. Q. Suppose that all edges weights in a graph are integers in the range of 1 to |V|. How fast can you make Kruskal’s algorithm run? A. Sorting |E| elements with values in the range of 1 to |V| takes O(V+E) (counting sort), find-set using an efficient union-find takes log*(E) (very fast) – total complexity of O(E log*(E)). (another reminder) DAST 2005

  4. Q. Let G be a connected undirected graph with the property that every edge has a different weight. Prove that there is only one minimum spanning tree for G. A. We assume there are two such trees and show there is a contradiction: exchange lemma: Let T and T’ be spanning trees in G(V,E). Given any there exists an edge such that is also a spanning tree proof (outline): adding e’ to T results in a cycle. Removing an edge e along this cycle restores the spanning tree Now suppose there are two MSTs to G, let e’ be the lightest edge in T’ -T, we will add e’ to T, but get a contradiction when trying to remove an edge from the resulting cycle. DAST 2005

More Related