This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Fall Semester 2008 CS300 Algorithms Homework #2 (due 10/10) 1. We can recursively define the number of combinations of m things out of n , denoted ( n m ) , for n ≥ 1 and 0 ≤ m ≤ n , by ( n m ) = 1 if m = 0 or m = n ( n m ) = ( n 1 m ) + ( n 1 m 1 ) if 0 < m < n (a) Give a recursive function to compute ( n m ) . (b) What is its worstcase running time as a function of n ? (c) Give a dynamic programming algorithm to compute ( n m ) . Hint 1 The algorithm constructs a table generally known as Pascal’s triangle. (d) What is the running time of your answer to (c) as a function of n ? 2. Suppose you are consulting for a company that manufactures PC equipment and ships it to distributors all over the country. For each of the next n weeks, they have a projected supply s i of equipment (measured in pounds), which has to be shipped by an air freight carrier. Each week’s supply can be carried by one of two air freight companies, A or B....
View
Full
Document
This note was uploaded on 02/04/2010 for the course COMPUTER S cs300 taught by Professor Unkown during the Spring '08 term at Korea Advanced Institute of Science and Technology.
 Spring '08
 Unkown
 Algorithms

Click to edit the document details