*Due Monday, February 10 at 5:00 PM. Please refer to the homework policy here. We are hoping to put out solutions for this homework right after the submission deadline, and there will be no homework assigned on Thursday.*

- Let and be two arbitrary arrays. A
*common super sequence*of and is another sequence that contains both and as subsequences. Describe an efficient algorithm to compute the length of the*shortest*common supersequence of and . - Problem 42 (a), (b), (c), (d) in Chapter 3 of Jeff's notes.
- Problem 46 in Chapter 3 of Jeff's notes.

For dynamic programming problems, we request you follow the following templates (which I also use in real life).

We will use the *longest increasing subsequence* problem (see for example Section 3.6 of Jeff's notes). We take as input a sequence of numbers. A subsequence (where ) is "increasing" if we have for each . For example, in the following sequence, the subsequence of odd numbers form an increasing subsequence.

For this class it suffices to solve things up to 5 parts.

LIS(i,j) = Longest increasing subsequence of where each number in the subsequence is .

In the examples in class, this was just one particular subproblem. Here we actually take the maximum over some of the subproblems. We give some brief justification here since this is not as simple as just returning an obvious subproblem.

We return the maximum of over . Here each choice of corresponds to the maximum length increasing subsequence starting from .

Here we give a recursive specification that implements per the semantic formulation above. Check your base cases!

Usually the reasoning is transparent from the recursive spec and the correctness follows easily enough that we won't demand a full proof. (Usually the correctness is clear at the level of the semantic problem formulation above.) If there was something much more complicated going on, then some explanation or even a proof would be expected.

We compute for and , so there are total subproblems.

Give the full running time. Here, please mention explicitly that you are "using dynamic programming" or "caching solutions to subproblems" to obtain the faster running time.

Each subproblem takes constant time plus work delegated to recursive calls. There are total subproblems. By caching solutions to all subproblems, the total algorithm takes time.

Another example of a worked out solution is given in Homework 5 of Jeff's Spring 2018 course. Note that our rubric is a little simpler in that we don't ask for a space bound (which is usually the number of subproblems, with some exceptions) or any explicit mention if the iteration order (which is usually straightforward or implicit in the correctness). Here our emphasis is on getting the subproblem definition correctly and implementing the recursive spec correctly.