**This is an old revision of the document!**

Homework Assignment #18


To apply dynamic programming to a new problem: the longest common subsequence problem.


Show all work neatly.

Question 1

Solve problem 6.11 in the textbook using the first four steps of our 6-step process of Dynamic Programming. Show each step. (3 points each)

Note that a common sub-sequence need not be contiguous. e.g., for <math>x=(A,Z,C,D,E,F)</math> and <math>y=(R,S,A,Z,T,Q,D)</math>, the sub-sequence <math>(A,Z,D)</math> occurs in both and is therefore common, even though its members are not contiguous. It is also the longest such sub-sequence.

Question 2

Use your solution from question (1) to show step 5 and step 6 (3 points each) of the DP process to solve the following longest common sub-sequence instance: <math>x=(p,s,e,u,d,o,p,o,l,y,n,o,m,i,a,l)</math> and <math>y=(p,n,e,u,m,a,t,i,c)</math>. For step #5, show your completed table, and report the length of the longest common sub-sequence. Also show how to keep suitable back-pointers. For step #6, extract the two optimal sub-sequences using the back-pointers.

Question 3

More fun: Place the answers from question (2) in order according to which one would come first in the dictionary. Take the first one and remove the 'e'. Translate it from Spanish into English. Go, Cougars!

cs-312/hw18.1420067089.txt.gz · Last modified: 2014/12/31 16:04 by ringger
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0