hwk5 - Fall 2011 Clyde Kruskal CMSC 451: Homework 5 Due at...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Fall 2011 Clyde Kruskal CMSC 451: Homework 5 Due at the start of class Tuesday, November 22, 2011. Problem 1. Use the dynamic programming algorithm to find by hand an optimal parenthesization for multiplying matrices of dimensions are given by the sequence < 6, 3, 10, 5, 8, 4, 20 > . Show the table. You may use a calculater. Problem 2. Write an efficient algorithm to determine an order of evaluating the matrix product M1 × M2 × M3 . . . × Mn so as to minimize the scalar multiplications in the case where each M is of dimension 1 × 1, 1 × d, d × 1, d × d for some fixed d. Problem 3. The number of combinations of n things taken m at a time puted using the following recurrence: n m = n−1 n−1 + m m−1 n m can be com- for 0 < m < n and n 0 = n n (a) Write a recursive algorithm to compute = 1. n m using the above recurrence. (b) Show that the worst-case running time of your algorithm can be exponential in n (depending on the value of m). (c) Produce a memoized version of your algorithm. (d) Give a dynamic programming algorithm to compute n m . (e) Analyze the running time of your dynamic programming algorithm as a function of m and n. Problem 5. Do Exercise 6 on pages 317-318 of Kleinberg and Tardos. ...
View Full Document

This note was uploaded on 01/13/2012 for the course CMSC 451 taught by Professor Staff during the Fall '08 term at Maryland.

Ask a homework question - tutors are online