ECS 122A, Homework 4

Due 4pm Wds Nov 9 in the Homework Box in 2131 Kemper Hall.

1. Say we want to find an order for multiplying a sequence of matrices which MAXIMIZES the number of scalar multipies required. Can we use a similar dynamic programming algorithm? If so, describe how to change the algorithm and argue in a few sentences that it is still correct. If not, argue in a few sentences why it would not work.

2. Do problem 15.2-3. Juan will give an example of using a proof by substitution for a lower bound in Section on Friday.

3. Here is a simpler version of problem 15-3. We want to figure out the minimum cost required to transform a string x into another string y. We work from left to right, maintaining a pointer i into the input string X and a pointer j into the output string Y. Initially i=j=0. There are four operations allowed:

The costs of these operations are: Use dynamic programming to design an algorithm to find the minimum cost sequence of operations, and to print it out. Analyse the running time of your algorithm.