Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Suppose that c1,c2,,cpis a longest common subsequence of the sequences a1,a2,,amandb1,b2,,bn.
a) Show that if am=bn, then cp=am=bnand c1,c2,,cp-1is a longest common subsequence of a1,a2,,am-1and b1,b2,,bn-1 when p>1.
b) Suppose that ambn. Show that if cpam, then c1,c2,,cpis a longest common subsequence of a1,a2,,am-1and b1,b2,,bnand also show that if cpbn, then c1,c2,,cpis a longest common subsequence of a1,a2,,amandb1,b2,,bn-1

Short Answer

Expert verified

(a)cp=am=bnfrom all three sequences, then c1,c2,,c(p-1)has to be the longest common subsequence of the sequences a1,a2,,am-1andb1,b2,,bn-1.

(b) The two sequences then need to have been one of the remaining m-1terms in the sequence and thusc1,c2,,cp has to be the longest common subsequence of the sequences a1,a2,,amandb1,b2,,bn-1

Step by step solution

01

Given data

c1,c2,,cpis the longest common subsequence of the sequences a1,a2,,amandb1,b2,,bn.

02

Definition

A recurrence relation is an equation that recursively defines a sequence where the next term is a function of the previous terms.

03

Simplify the solution of part (a)

Given: c1,c2,,cpis the longest common subsequence of the sequences a1,a2,,amand b1,b2,,bn.

Note: The longest common subsequence does not require to be a subsequence of consecutive terms.

am=bn

If am=bn, then this means that the last two elements in the two sequences a1,a2,,amand b1,b2,,bn.are identical and thus the element am=bnis common in both sequences.

Since the element am=bnis common in both sequences, the element am=bnneeds to be contained in the longest common subsequencec1,c2,,cp.
Since amand bnare the last terms in the two sequences a1,a2,,amand b1,b2,,bn., the element in the longest common subsequence also has to be the last term:

cp=am=bn

Moreover, if we remove the element cp=am=bnfrom all three sequences, then c1,c2,,c(p-1)has to be the longest common subsequence of the sequences a1,a2,,am-1and b1,b2,,bn-1.(as we only removed the last element that was common in all three sequences).

04

Simplify the solution of part (b)

ambn

First case If ambnand cpam,then this means that the last common element between the sequences a1,a2,,amand b1,b2,,bnis not am, and thus amis not common with any element in the sequence b1,b2,,bn.

The last common element between the two sequences then needs to have been one of the remaining m-1terms in the sequence and thus c1,c2,,cphas to be the longest common subsequence of the sequences a1,a2,,am-1and b1,b2,,bn

Second case If ambnand cpbn, then this means that the last common element between the sequences a1,a2,,amand b1,b2,,bnis not bn, and thus bnis not common with any element in the sequence a1,a2,,am

The last common element between the two sequences then needs to have been one of the remaining m-1terms in the sequence and thus c1,c2,,cphas to be the longest common subsequence of the sequences a1,a2,,amandb1,b2,,bn-1

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Find a closed form for the generating function for the sequence\(\left\{ {{a_n}} \right\}\), where

a) \({a_n} = - 1\) for all\(n = 0,1,2, \ldots \).

b) \({a_n} = {2^n}\)for\(n = 1,2,3,4, \ldots \)and\({a_0} = 0\).

c) \({a_n} = n - 1\)for\(n = 0,1,2, \ldots \).

d) \({a_n} = 1/(n + 1)!\)for\(n = 0,1,2, \ldots \)

e) \({a_n} = \left( {\begin{array}{*{20}{l}}n\\2\end{array}} \right)\)for\(n = 0,1,2, \ldots \)

f) \({a_n} = \left( {\begin{array}{*{20}{c}}{10}\\{n + 1}\end{array}} \right)\)for\(n = 0,1,2, \ldots \)

Use generating functions to solve the recurrence relation ak=5ak-1-6ak-2with initial conditions a0=6and a1=30.

Find the coefficient of x5y8in(x+y)13.

If G(x) is the generating function for the sequence{ak}, what is the generating function for each of these sequences?

a) 0,0,0,a3,a4,a5,(Assuming that terms follow the pattern of all but the first three terms)

b)a0,0,a1,0,a2,0,

c) 0,0,0,0,a0,a1,a2,(Assuming that terms follow the pattern of all but the first four terms)

d)a0,2a1,4a2,8a3,16a4,

e) 0,a0,a1/2,a2/3,a3/4, [Hint: Calculus required here.]

f) a0,a0+a1,a0+a1+a2,a0+a1+a2+a3,

How many ternary strings of length six do not contain two consecutive0'sor twoconsecutive1's?

Find a closed form for the generating function for each of these sequences. (For each sequence, use the most obvious choice of a sequence that follows the pattern of the initial terms listed.)

a) \(0,2,2,2,2,2,2,0,0,0,0,0, \ldots \)

b) \(0,0,0,1,1,1,1,1,1, \ldots \)

c) \(0,1,0,0,1,0,0,1,0,0,1, \ldots \)

d) \(2,4,8,16,32,64,128,256, \ldots \)

e) \(\left( {\begin{array}{*{20}{l}}7\\0\end{array}} \right),\left( {\begin{array}{*{20}{l}}7\\1\end{array}} \right),\left( {\begin{array}{*{20}{l}}7\\2\end{array}} \right), \ldots ,\left( {\begin{array}{*{20}{l}}7\\7\end{array}} \right),0,0,0,0,0, \ldots \)

f) \(2, - 2,2, - 2,2, - 2,2, - 2, \ldots \)

g) \(1,1,0,1,1,1,1,1,1,1, \ldots \)

h) \(0,0,0,1,2,3,4, \ldots \)

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free