HW2 - Fall Semester 2008 CS300 Algorithms Homework #2 (due...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 worst-case 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.

Page1 / 2

HW2 - Fall Semester 2008 CS300 Algorithms Homework #2 (due...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online