UMBC CMSC441, Design & Analysis of Algorithms, Fall 2014

Homework 10

Due Thursday, November 6, 2014

  1. Prim's algorithm on graphs with restricted edge weights.
    Exercise 23.2-5, page 637.

  2. Yet Another MST Algorithm.
    Here's another approach to finding a minimum spanning tree in an undirected graph G = (V, E) with weight function w: E → ℜ. The main idea of this algorithm is to maintain a subgraph G' = (V, E') such that each component of G' is a tree. In each iteration of the outer loop we add some edges that merge some of the components together.
     1.   Let E' = empty set
     2.   Loop indefinitely {
     3.      Let G' = (V, E')
     4.      Run DFS on G'. During the DFS, label each vertex v
                with the root of the DFS tree that contains v.
     5.      Foreach DFS tree T  {
     6.          find the smallest weight edge (u, v) ∈ E 
                    such that u ∈ T and v ∉ T.
     7.          add (u,v) to E', unless (u,v) is already in E'.
     8.          if E' has V-1 edges, return
     9.      }   /* end Foreach DFS tree */
    10.   }   /* end Loop indefinitely */

    Note that line 6 refers to the original edge set E whereas lines 7&8 refer to the set E' of edges selected to be part of the minimum spanning tree.

    For simplicity, assume that all edge weights are distinct.

    Answer these questions:

    1. Show how each iteration of the loop in lines 5–9 can be implemented to run in O( E ) time.
    2. Argue that each iteration of the outer loop in lines 2–10 takes O(E) time.
    3. Argue that the outer loop has at most log V iterations.
    4. What is the worst-case running time of this algorithm?
    5. Argue that this algorithm correctly finds a minimum spanning tree of G.

  3. Printing disjoint sets. Exercise 21.3-4, page 572.
    Additional Instructions: For each of the Make-Set(), Union(), Link(), and Find-Set() operations, explicitly explain how your modifications to the dijoint-set forest data structure affects the operation. For each operation, argue that your modifications do not alter its asymptotic running time.
    Note: "one attribute" really means just one thing. If you store a pair of references, that still counts as two things.

Last Modified: 29 Oct 2014 10:37:56 EDT by Richard Chang
to Fall 2014 CMSC 441 Section 2 Homepage