HOMEWORK 2 SOLUTIONS

CS510



  1. page 160, Exercise 6.2 (5 points)
  2. page 160, Exercise 6.3 (5 points)

  3. page 160, Exercise 6.5 (5 points)
    1. Prove that the low degree spanning tree is NP-hard with a reduction from Hamiltonian Path.
      • Low Degree Spanning Tree
        Input: A graph G and an integer k.
        Question: Does G contain a spanning tree such that all vertices in the tree have degree at most k?
      • Hamiltonian Path
        Input: A graph G = (V, E).
        Question: Does there exist a path in G that contains all the vertices?
      • Reduction:
          Ham Path (G)
            Let G' = G
            let k'=2
            MinSpanTree(G', k')
      • Show the answers are equivalent:
          Assume that there is a hamiltonian path in G. Take the hamiltonian path to be the minimum degree spanning tree (since its maximum degree is 2). Assume that there is a low degree spanning tree of maximum degree 2, then it must be a hamiltonian path since its spanning. Thus, the answers are equivalent.
    2. Give an efficient algorithm to solve the high degree spanning tree problem and an analysis of its time complexity.
      • Algorithm HighSpanTree(G, k):
          Calculate di = degree of vertex i
          let k'=max {di, i = 1, 2, ..., # of vertices}
          if k <= k' return true, else return false
      • Analysis: Since it takes linear time (in # of edges + # of vertices) to calculate the degrees and linear time (in # of vertices) to find the maximum of the ki's, it must take a linear time (in # of vertices and edges) to run the algorithm.
  4. Write a paragraph or two explaining how what you have learned in this class will make you a better algorithm designer. You may use specific examples if you need.

    There is no one unique solution.