UMBC CMSC441, Design & Analysis of Algorithms, Fall 2004, Section 0101

Homework Assignments


Homework 1, Due Tuesday 09/14

  1. Exercise A.1-4, page 1062. (This is not really a starred problem.)

  2. Problem 4-1, parts a-h, page 85.
    Find asymptotic upper bounds only. You must use either the recursion tree method or the substitution method. Show all work.

  3. Problem 4-4, parts a, b, g & h, page 86.
    Find asymptotic lower bounds only. You must use either the recursion tree method or the substitution method. Show all work.


Homework 2, Due Tuesday 09/21

  1. Exercise 4.3-1, parts a-c, page 75.

  2. Exercise 6.4-4, page 136.

  3. Exercise 6.5-7, page 142.


Homework 3, Due Tuesday 09/28

  1. Problem 6-3, parts a-e, page 143.
    (You do not have to do part f on page 144.)

  2. Problem 7-3 a-c, page 161-162.
    Note: Part a requires that you argue that given any sequence of n numbers to sort, StoogeSort puts the numbers in the correct places. You should use induction and assume that the StoogeSort sorts correctly given fewer inputs.

  3. Problem 7-4, page 162.


Homework 4, Due Tuesday 10/05

  1. Exercise 8.1-3, page 168.

  2. Problem 8-3 part b, page 179.

  3. Exercise 9.3-8, page 193.


Homework 5, Due Tuesday 10/12

  1. Exercise 9.3-7, page 193.

  2. Exercise 11.2-5, page 229.

  3. Problem 13-2, parts a-f, pages 295-296.


Homework 6, Due Thursday 10/19

  1. Exercise 9.3-6, page 192.

  2. Exercise 11.3-3, page 236.

  3. Problem 15-1, page 364.


Homework 7, Due Thursday 10/26

(Also available in PDF: hw7.pdf.)
  1. Exercise 15.3-5, page 350.
  2. Problem 15-4, page 367.
  3. [Tickets to Rides: Dynamic Programming] You arrive at Waldo's World Amusement Park with T minutes before the park closes. The park has n rides and your objective is to complete as many rides as possible before the park closes. (For this problem, taking the same ride twice counts as 2 rides.) You are given a table W such that W(i,t) gives you the waiting time for ride i at time t. For convenience, assume that t is to be given as minutes before the park closes. Ride i itself takes ri minutes and all times are measured in integer minutes.
    1. Define a subproblem, MaxRides, that can be used to solve this dynamic programming problem. To do this, you must describe the input parameters to MaxRides and the "return value" using English sentences.
    2. Give a mathematical formula that shows how MaxRides can be computed recursively. Then, explain all the parts of the formula using English sentences.
    3. Describe how MaxRides 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. Which entry has the solution to the original problem?
    4. Analyze and justify the running time of your dynamic programming algorithm.


Homework 8, Due Thursday 11/02

  1. Exercise 16.1-4, page 379.

  2. Exercise 16.2-4, page 384.
    Note: Previously posted hint made no sense at all. It was for a different version of this problem that included gas prices.

  3. Exercise 16.2-5, page 384.


Homework 9, Due Tuesday 11/09

(Also available in PDF: hw9.pdf.)

  1. Greedy Trick or Treat.

    Consider the following Trick-or-Treat problem. You live on a street with n houses. You have a bag to carry your Halloween candy, but your bag can carry at most K ounces of candy. You are given for each house i, an integer weight integer wi (in ounces) of the candy that the people in house i are handing out. Each house gives out one piece of candy. You can visit each house at most once. Your problem is to collect the largest number of pieces of candy from the n houses without exceeding the capacity of your bag.

    Now consider the following greedy algorithm. Sort the houses according to the weight of the candy they are providing. Collect candy from the houses starting from the house that provides the lightest candy, then the next lightest, ... until your bag is full.

    Give a convincing argument (i.e., a proof) that this greedy strategy results in an optimum solution to the problem given above.

  2. Exercise 22.2-6, page 539.
    Note: You must prove that your algorithm always produces the correct result.

  3. Question #3 moved to Homework 10.


Homework 10, Due Tuesday 11/16

  1. Exercise 22.3-7, page 548.

  2. Exercise 22.3-10, page 549.

  3. Exercise 22.4-5, page 552.


Homework 11, Due Tuesday 11/30

  1. Exercise 22.5-7, page 557.
    Hint: Think about the component graph.

  2. Problem 22-3, page 559.

  3. Exercise 23.1-6, page 566.


Homework 12, Due Tuesday 12/07

  1. Exercise 21.3-3, page 509.

  2. Exercise 23.2-5, page 574.

  3. Exercise 24.3-6, page 600.
    Note: the answer is not the same as the answer for Ex 23.2-5.


Homework 13, Due Tuesday 12/14

  1. Problem 24-3a, page 615.

  2. Exercise 25.2-6, page 635. Note: You must argue that your algorithm is correct.

  3. Problem 26-1, page 692.


Last Modified: 7 Dec 2004 13:58:21 EST by Richard Chang
to Fall 2004 CMSC 441 Section Homepage