CMSC 641 Design & Analysis of Algorithms, Fall 2014

Homework Assignments

Homework 1, Due Tuesday 09/09

Note: When you describe an algorithm, do not use code or pseudocode. Write in clear English paragraphs that describe the high-level strategy of your algorithm. For example, if you want to sort an array, just write "sort the array A". Pictures are often very helpful. If the logic is quite detailed, you may use pseudocode, but this is in addition to your English explanation not instead of it.

  1. Scheduling to minimize average completion time.
    Problem 16-2, part a, page 447.

    Further Instructions: You must prove that the schedule produced by your algorithm has an average completion time that is lower than or equal to the average completion time of any other schedules. Appeals to general principle (e.g. "It is always better to ...") are not acceptable proofs because they simply restate what needs to be proven.

  2. Scheduling to minimize average completion time.
    Problem 16-2, part b, page 447.

    Further Instructions: follow guidelines for proof of optimality given above.

  3. Exercise 16.4-5, page 443.

Homework 2, Due Tuesday 09/16

Additional instructions for questions 1 and 2: When you are asked to provide a dynamic programming algorithm. You must provide the following:
  1. Define a function OPT that can be used to solve this dynamic programming problem. To do this, you must describe the input parameters to OPT and the "return value" using English sentences. (Note: you are specifying the input-output relation of the function. You should not describe how to compute the function.)
  2. Give a mathematical formula that shows how OPT can be computed recursively. Then, explain all the major parts of the formula using English sentences. Remember to include the base cases.
  3. Describe how OPT can be computed bottom up using a dynamic programming table. Be sure to include a description of the dimensions of the table and the order that the entries of the table are to be filled. Draw a diagram. Which entry has the solution to the original problem?
  4. Analyze and justify the running time of your dynamic programming algorithm.


  1. You work in the shipping department of Vitamins-R-Us. The company has contracted with Acme Parcel Service to ship its packages. Acme provides m different sizes of boxes that hold x1, x2, ... xm bottles of vitamins and cost, respectively, c1, c2, ... cm dollars to ship anywhere in the country. When a client places an order for n bottles of vitamins, you must select a combination of these boxes to hold all n bottles that minimizes the total shipping cost. You may use more than one box of each size. However, do not assume any relationship between the size xi and the cost ci.

  2. Problem 15-3, page 405.

  3. Problem 17-3, parts a–e, pages 473–474

Homework 3, Due Tuesday 09/23

  1. Exercise 17.3-6, page 463.
    Additional Instructions: Use the accounting method for your amortized analysis.

  2. Exercise 21.3-5, page 572.
    Additional Instructions: Use the accounting method for your amortized analysis.

  3. Problem 21-1, parts a-c, pp. 582-583.

Homework 4, Due Tuesday 09/30

  1. Exercise 17.2-3, page 459.
    Note: The question specifies that it takes Θ(1) time just to examine a bit. So, it takes Θ(1) time to check if a bit is 1, even if it turns out to be 0 and does not need to be flipped.

  2. Exercise 19.4-1, page 526.

  3. Problem 19-3, part a, page 529.

Homework 5, Due Tuesday 10/07

  1. Exercise 26.1-3, page 713.

  2. Problem 26-1, pages 760-761.

  3. Problem 26-4, page 762.

Homework 6, Due Tuesday 10/14

  1. Edge Connectivity. Exercise 26.2-11, page 731.

  2. Max Flow by Scaling. Problem 26-5, parts a–f, pages 762–763

  3. Spring 2010, Quiz 3. Do Quiz 3 from Spring 2010: CMSC641-Spring-2010-Q3.pdf.

Homework 7, Due Tuesday 10/21

Note: [DPV] = Algorithms by Dasgupta, Papadimitriou and Vazirani.

  1. Exercise 7.16, "Salad", in Chapter 7 of [DPV], page 241.

Homework 8, Due Tuesday 10/28

Note: [DPV] = Algorithms by Dasgupta, Papadimitriou and Vazirani.

  1. Exercise 7.29 "Hollywood", in Chapter 7 of [DPV], page 230/245.

  2. Linear Program for shortest paths. Exercise 29.2-2, page 863.

Homework 9, Due Tuesday 11/04

  1. Integer Programming. Integer Programming is just like Linear Programming except the set of feasible solutions is restricted to points where all of the variables take on integer values. The decision version of Integer Programming is to decide if there exists a feasible solution with objective function greater than a given bound B. Show that the decision version of Integer Programming is NP-complete.

  2. Finding the largest clique. Suppose you were given a "black box" that can decide the Clique problem in constant time. That is you give the black box an undirected graph G and a bound t and the black box will either say "Yes, G has a clique with at least t vertices," or "No, G does not have a clique with at least t vertices."

    Show how you can use this black box to find the vertices of a maximum clique in a graph in polynomial time.

  3. Dominating Set. In an undirected graph G = (V, E), a dominating set V' is a subset of the vertices V such that for all vertices uV, either uV' or there exists vV' such that (u, v) ∈ E. Define the set DOM to be
    DOM = { (G, k) } | G has a dominating set with k or fewer vertices. }
    Show that DOM is NP-complete. Hint: reduce from Vertex Cover.

Homework 10, Due Tuesday 11/11

  1. 3-coloring a graph. Suppose you are given a "black box" that can decide the 3-Coloring problem in constant time. That is, when you give the black box an undirected graph G, it will either say "Yes, G can be colored with 3 colors" or "No, G cannot be colored with 3 colors."

    Show how you can use this black box to find a 3-coloring of G in polynomial time. (I.e., you must be able to assign red, green or blue to each vertex of the graph such that no two adjacent vertices have the same color.)

  2. Hamiltonian Path. An undirected graph G = (V, E) has a Hamiltonian path from vertex s to vertex t if the path includes every vertex of G exactly once. The HAM_PATH decision problem is the following:
    Input: an undirected graph G = (V, E) and two designated vertices sV and tV.
    Decide: Does G have a Hamiltonian path from s to t?

    Construct a polynomial-time ≤m-reduction from the Hamiltonian Cycle problem to HAM_PATH.

  3. An edge in every cycle. Consider the following decision problem X:
    Input: a directed graph G = (V, E) and a number k.
    Decide: Does there exist a subset of edges E'E such that |E'| ≤ k and for every cycle in G, at least one edge in the cycle is in E' ?
    Show that X is NP-complete.

    Note: a graph can have an exponential number of cycles. So, when you show that X ∈ NP, you cannot simply guess E' and check every cycle in G. That would take exponential time.

Homework 11, Due Tuesday 11/18

  1. Exercise 35.1-1, page 1111.

  2. Exercise 35.1-4, page 1111.
    Additional instructions: Argue that your algorithm does produce the optimal vertex cover.

Homework 12, Due Tuesday 11/25

  1. Problem 35-1, page 1134.

  2. Problem 35-2, pages 1134-1135.

  3. Problem 35-3, page 1135.

Homework 13, Due Tuesday 12/09

For this homework set, download Chapter 13 of Algorithm Design by Kleinberg & Tardos [KT]: here.

  1. 3-Coloring. Exercise 1, p. 782 [KT].

  2. one-pass auction. Exercise 9, p. 788 [KT].

Last Modified: 4 Dec 2014 01:30:10 EST by Richard Chang
to Fall 2014 CMSC 641 Homepage