SlideShare a Scribd company logo
1 of 2
Algorithm below...
a) IF n = 0 return 0
(b) IF m = 0 return 0
(c) IF w 1 = v 1 return 1 + LCS(w 2 ..w n , v 2 ..v m )
(d) Return max(LCS(w 2 ..w n , v 1 ..v m ), LCS(w 1 ..w n , v 2 ..v m )
Solution
Let the input sequences be X[0..m-1] and Y[0..n-1] of lengths m and n respectively. And let
L(X[0..m-1], Y[0..n-1]) be the length of LCS of the two sequences X and Y. Following is the
recursive definition of L(X[0..m-1], Y[0..n-1]).
If last characters of both sequences match (or X[m-1] == Y[n-1]) then
L(X[0..m-1], Y[0..n-1]) = 1 + L(X[0..m-2], Y[0..n-2])
If last characters of both sequences do not match (or X[m-1] != Y[n-1]) then
L(X[0..m-1], Y[0..n-1]) = MAX ( L(X[0..m-2], Y[0..n-1]), L(X[0..m-1], Y[0..n-2])
Examples:
1) Consider the input strings “AGGTAB” and “GXTXAYB”. Last characters match
for the strings. So length of LCS can be written as:
L(“AGGTAB”, “GXTXAYB”) = 1 + L(“AGGTA”, “GXTXAY”)
2) Consider the input strings “ABCDGH” and “AEDFHR. Last characters do not match
for the strings. So length of LCS can be written as:
L(“ABCDGH”, “AEDFHR”) = MAX ( L(“ABCDG”, “AEDFHR”),
L(“ABCDGH”, “AEDFH”) )
/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
int lcs( char *X, char *Y, int m, int n )
{
if (m == 0 || n == 0)
return 0;
if (X[m-1] == Y[n-1])
return 1 + lcs(X, Y, m-1, n-1);
else
return max(lcs(X, Y, m, n-1), lcs(X, Y, m-1, n));
}

More Related Content

Similar to Algorithm below--- a) IF n - 0 return 0 (b) IF m - 0 return 0 (c) IF w.docx

Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common SubsequenceSwati Swati
 
Harmonic waves
Harmonic wavesHarmonic waves
Harmonic wavesJenny He
 
Series solution to ordinary differential equations
Series solution to ordinary differential equations Series solution to ordinary differential equations
Series solution to ordinary differential equations University of Windsor
 
Dynamic programming - fundamentals review
Dynamic programming - fundamentals reviewDynamic programming - fundamentals review
Dynamic programming - fundamentals reviewElifTech
 
On Application of the Fixed-Point Theorem to the Solution of Ordinary Differe...
On Application of the Fixed-Point Theorem to the Solution of Ordinary Differe...On Application of the Fixed-Point Theorem to the Solution of Ordinary Differe...
On Application of the Fixed-Point Theorem to the Solution of Ordinary Differe...BRNSS Publication Hub
 
Mathematical Foundations for Machine Learning and Data Mining
Mathematical Foundations for Machine Learning and Data MiningMathematical Foundations for Machine Learning and Data Mining
Mathematical Foundations for Machine Learning and Data MiningMadhavRao65
 
Longest common subsequence(dynamic programming).
Longest common subsequence(dynamic programming).Longest common subsequence(dynamic programming).
Longest common subsequence(dynamic programming).munawerzareef
 
Assignment no4
Assignment no4Assignment no4
Assignment no4Ali Baig
 
Pydata Katya Vasilaky
Pydata Katya VasilakyPydata Katya Vasilaky
Pydata Katya Vasilakyknv4
 
Solution set 3
Solution set 3Solution set 3
Solution set 3慧环 赵
 

Similar to Algorithm below--- a) IF n - 0 return 0 (b) IF m - 0 return 0 (c) IF w.docx (20)

lec z-transform.ppt
lec z-transform.pptlec z-transform.ppt
lec z-transform.ppt
 
Longest Common Subsequence
Longest Common SubsequenceLongest Common Subsequence
Longest Common Subsequence
 
Harmonic waves
Harmonic wavesHarmonic waves
Harmonic waves
 
Series solution to ordinary differential equations
Series solution to ordinary differential equations Series solution to ordinary differential equations
Series solution to ordinary differential equations
 
Dynamic programming - fundamentals review
Dynamic programming - fundamentals reviewDynamic programming - fundamentals review
Dynamic programming - fundamentals review
 
Vector space
Vector spaceVector space
Vector space
 
On Application of the Fixed-Point Theorem to the Solution of Ordinary Differe...
On Application of the Fixed-Point Theorem to the Solution of Ordinary Differe...On Application of the Fixed-Point Theorem to the Solution of Ordinary Differe...
On Application of the Fixed-Point Theorem to the Solution of Ordinary Differe...
 
02_AJMS_186_19_RA.pdf
02_AJMS_186_19_RA.pdf02_AJMS_186_19_RA.pdf
02_AJMS_186_19_RA.pdf
 
02_AJMS_186_19_RA.pdf
02_AJMS_186_19_RA.pdf02_AJMS_186_19_RA.pdf
02_AJMS_186_19_RA.pdf
 
Signals and Systems Assignment Help
Signals and Systems Assignment HelpSignals and Systems Assignment Help
Signals and Systems Assignment Help
 
Mathematical Foundations for Machine Learning and Data Mining
Mathematical Foundations for Machine Learning and Data MiningMathematical Foundations for Machine Learning and Data Mining
Mathematical Foundations for Machine Learning and Data Mining
 
Longest common subsequence(dynamic programming).
Longest common subsequence(dynamic programming).Longest common subsequence(dynamic programming).
Longest common subsequence(dynamic programming).
 
Vector Space.pptx
Vector Space.pptxVector Space.pptx
Vector Space.pptx
 
Lo 2
Lo 2Lo 2
Lo 2
 
Double & triple integral unit 5 paper 1 , B.Sc. 2 Mathematics
Double & triple integral unit 5 paper 1 , B.Sc. 2 MathematicsDouble & triple integral unit 5 paper 1 , B.Sc. 2 Mathematics
Double & triple integral unit 5 paper 1 , B.Sc. 2 Mathematics
 
Digital signal processing
Digital signal processingDigital signal processing
Digital signal processing
 
Assignment no4
Assignment no4Assignment no4
Assignment no4
 
Pydata Katya Vasilaky
Pydata Katya VasilakyPydata Katya Vasilaky
Pydata Katya Vasilaky
 
Solution set 3
Solution set 3Solution set 3
Solution set 3
 
Imc2017 day1-solutions
Imc2017 day1-solutionsImc2017 day1-solutions
Imc2017 day1-solutions
 

More from wviola

Alice intends to send a secure message to Bob- (1) What are the threat.docx
Alice intends to send a secure message to Bob- (1) What are the threat.docxAlice intends to send a secure message to Bob- (1) What are the threat.docx
Alice intends to send a secure message to Bob- (1) What are the threat.docxwviola
 
Add a function prototype for the function sumNum- # include using nam.docx
Add a function prototype for the function sumNum- # include  using nam.docxAdd a function prototype for the function sumNum- # include  using nam.docx
Add a function prototype for the function sumNum- # include using nam.docxwviola
 
Add a new check on the emp table to make sure that any new employee in.docx
Add a new check on the emp table to make sure that any new employee in.docxAdd a new check on the emp table to make sure that any new employee in.docx
Add a new check on the emp table to make sure that any new employee in.docxwviola
 
Adding elements to an Array- Given the following simple List class tha.docx
Adding elements to an Array- Given the following simple List class tha.docxAdding elements to an Array- Given the following simple List class tha.docx
Adding elements to an Array- Given the following simple List class tha.docxwviola
 
Ad by DealsFactor - Close Menlo Company Contribution Income.docx
Ad by DealsFactor - Close           Menlo Company Contribution Income.docxAd by DealsFactor - Close           Menlo Company Contribution Income.docx
Ad by DealsFactor - Close Menlo Company Contribution Income.docxwviola
 
Action Center activation Administrative Tools Aero applets Computer Co (2).docx
Action Center activation Administrative Tools Aero applets Computer Co (2).docxAction Center activation Administrative Tools Aero applets Computer Co (2).docx
Action Center activation Administrative Tools Aero applets Computer Co (2).docxwviola
 
Acids Bases Taste Taste pH greater than pH less tharn Acids effect ind.docx
Acids Bases Taste Taste pH greater than pH less tharn Acids effect ind.docxAcids Bases Taste Taste pH greater than pH less tharn Acids effect ind.docx
Acids Bases Taste Taste pH greater than pH less tharn Acids effect ind.docxwviola
 
Action Center activation Administrative Tools Aero applets Computer Co.docx
Action Center activation Administrative Tools Aero applets Computer Co.docxAction Center activation Administrative Tools Aero applets Computer Co.docx
Action Center activation Administrative Tools Aero applets Computer Co.docxwviola
 
Action Center activation Administrative Tools Aero applets Computer Co (1).docx
Action Center activation Administrative Tools Aero applets Computer Co (1).docxAction Center activation Administrative Tools Aero applets Computer Co (1).docx
Action Center activation Administrative Tools Aero applets Computer Co (1).docxwviola
 
Acid lonization Constants (K-) for Some Monoprotic Weak Acids at 25 ec.docx
Acid lonization Constants (K-) for Some Monoprotic Weak Acids at 25 ec.docxAcid lonization Constants (K-) for Some Monoprotic Weak Acids at 25 ec.docx
Acid lonization Constants (K-) for Some Monoprotic Weak Acids at 25 ec.docxwviola
 
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 6Solut.docx
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 6Solut.docxAC 556 Accounting for Governmental & Nonprofit Entities Chapter 6Solut.docx
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 6Solut.docxwviola
 
Accounting Which of the following is true of a corporation- OA- The st.docx
Accounting Which of the following is true of a corporation- OA- The st.docxAccounting Which of the following is true of a corporation- OA- The st.docx
Accounting Which of the following is true of a corporation- OA- The st.docxwviola
 
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 7Solut.docx
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 7Solut.docxAC 556 Accounting for Governmental & Nonprofit Entities Chapter 7Solut.docx
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 7Solut.docxwviola
 
advantages and disadvantages of using centralized network management v.docx
advantages and disadvantages of using centralized network management v.docxadvantages and disadvantages of using centralized network management v.docx
advantages and disadvantages of using centralized network management v.docxwviola
 
Advantages & Disadvantages of Server Applications in 150+ wordsSolutio.docx
Advantages & Disadvantages of Server Applications in 150+ wordsSolutio.docxAdvantages & Disadvantages of Server Applications in 150+ wordsSolutio.docx
Advantages & Disadvantages of Server Applications in 150+ wordsSolutio.docxwviola
 
Does any one have a paper on human resource practices in countries bes.docx
Does any one have a paper on human resource practices in countries bes.docxDoes any one have a paper on human resource practices in countries bes.docx
Does any one have a paper on human resource practices in countries bes.docxwviola
 
Do you think Facebook should operate in China even if it means complyi.docx
Do you think Facebook should operate in China even if it means complyi.docxDo you think Facebook should operate in China even if it means complyi.docx
Do you think Facebook should operate in China even if it means complyi.docxwviola
 
Do you think contingent gains should be disclosed in the financial sta (1).docx
Do you think contingent gains should be disclosed in the financial sta (1).docxDo you think contingent gains should be disclosed in the financial sta (1).docx
Do you think contingent gains should be disclosed in the financial sta (1).docxwviola
 
Do you think contingent gains should be disclosed in the financial sta.docx
Do you think contingent gains should be disclosed in the financial sta.docxDo you think contingent gains should be disclosed in the financial sta.docx
Do you think contingent gains should be disclosed in the financial sta.docxwviola
 
Do you believe the double taxation of earnings which occurs at the cor.docx
Do you believe the double taxation of earnings which occurs at the cor.docxDo you believe the double taxation of earnings which occurs at the cor.docx
Do you believe the double taxation of earnings which occurs at the cor.docxwviola
 

More from wviola (20)

Alice intends to send a secure message to Bob- (1) What are the threat.docx
Alice intends to send a secure message to Bob- (1) What are the threat.docxAlice intends to send a secure message to Bob- (1) What are the threat.docx
Alice intends to send a secure message to Bob- (1) What are the threat.docx
 
Add a function prototype for the function sumNum- # include using nam.docx
Add a function prototype for the function sumNum- # include  using nam.docxAdd a function prototype for the function sumNum- # include  using nam.docx
Add a function prototype for the function sumNum- # include using nam.docx
 
Add a new check on the emp table to make sure that any new employee in.docx
Add a new check on the emp table to make sure that any new employee in.docxAdd a new check on the emp table to make sure that any new employee in.docx
Add a new check on the emp table to make sure that any new employee in.docx
 
Adding elements to an Array- Given the following simple List class tha.docx
Adding elements to an Array- Given the following simple List class tha.docxAdding elements to an Array- Given the following simple List class tha.docx
Adding elements to an Array- Given the following simple List class tha.docx
 
Ad by DealsFactor - Close Menlo Company Contribution Income.docx
Ad by DealsFactor - Close           Menlo Company Contribution Income.docxAd by DealsFactor - Close           Menlo Company Contribution Income.docx
Ad by DealsFactor - Close Menlo Company Contribution Income.docx
 
Action Center activation Administrative Tools Aero applets Computer Co (2).docx
Action Center activation Administrative Tools Aero applets Computer Co (2).docxAction Center activation Administrative Tools Aero applets Computer Co (2).docx
Action Center activation Administrative Tools Aero applets Computer Co (2).docx
 
Acids Bases Taste Taste pH greater than pH less tharn Acids effect ind.docx
Acids Bases Taste Taste pH greater than pH less tharn Acids effect ind.docxAcids Bases Taste Taste pH greater than pH less tharn Acids effect ind.docx
Acids Bases Taste Taste pH greater than pH less tharn Acids effect ind.docx
 
Action Center activation Administrative Tools Aero applets Computer Co.docx
Action Center activation Administrative Tools Aero applets Computer Co.docxAction Center activation Administrative Tools Aero applets Computer Co.docx
Action Center activation Administrative Tools Aero applets Computer Co.docx
 
Action Center activation Administrative Tools Aero applets Computer Co (1).docx
Action Center activation Administrative Tools Aero applets Computer Co (1).docxAction Center activation Administrative Tools Aero applets Computer Co (1).docx
Action Center activation Administrative Tools Aero applets Computer Co (1).docx
 
Acid lonization Constants (K-) for Some Monoprotic Weak Acids at 25 ec.docx
Acid lonization Constants (K-) for Some Monoprotic Weak Acids at 25 ec.docxAcid lonization Constants (K-) for Some Monoprotic Weak Acids at 25 ec.docx
Acid lonization Constants (K-) for Some Monoprotic Weak Acids at 25 ec.docx
 
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 6Solut.docx
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 6Solut.docxAC 556 Accounting for Governmental & Nonprofit Entities Chapter 6Solut.docx
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 6Solut.docx
 
Accounting Which of the following is true of a corporation- OA- The st.docx
Accounting Which of the following is true of a corporation- OA- The st.docxAccounting Which of the following is true of a corporation- OA- The st.docx
Accounting Which of the following is true of a corporation- OA- The st.docx
 
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 7Solut.docx
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 7Solut.docxAC 556 Accounting for Governmental & Nonprofit Entities Chapter 7Solut.docx
AC 556 Accounting for Governmental & Nonprofit Entities Chapter 7Solut.docx
 
advantages and disadvantages of using centralized network management v.docx
advantages and disadvantages of using centralized network management v.docxadvantages and disadvantages of using centralized network management v.docx
advantages and disadvantages of using centralized network management v.docx
 
Advantages & Disadvantages of Server Applications in 150+ wordsSolutio.docx
Advantages & Disadvantages of Server Applications in 150+ wordsSolutio.docxAdvantages & Disadvantages of Server Applications in 150+ wordsSolutio.docx
Advantages & Disadvantages of Server Applications in 150+ wordsSolutio.docx
 
Does any one have a paper on human resource practices in countries bes.docx
Does any one have a paper on human resource practices in countries bes.docxDoes any one have a paper on human resource practices in countries bes.docx
Does any one have a paper on human resource practices in countries bes.docx
 
Do you think Facebook should operate in China even if it means complyi.docx
Do you think Facebook should operate in China even if it means complyi.docxDo you think Facebook should operate in China even if it means complyi.docx
Do you think Facebook should operate in China even if it means complyi.docx
 
Do you think contingent gains should be disclosed in the financial sta (1).docx
Do you think contingent gains should be disclosed in the financial sta (1).docxDo you think contingent gains should be disclosed in the financial sta (1).docx
Do you think contingent gains should be disclosed in the financial sta (1).docx
 
Do you think contingent gains should be disclosed in the financial sta.docx
Do you think contingent gains should be disclosed in the financial sta.docxDo you think contingent gains should be disclosed in the financial sta.docx
Do you think contingent gains should be disclosed in the financial sta.docx
 
Do you believe the double taxation of earnings which occurs at the cor.docx
Do you believe the double taxation of earnings which occurs at the cor.docxDo you believe the double taxation of earnings which occurs at the cor.docx
Do you believe the double taxation of earnings which occurs at the cor.docx
 

Recently uploaded

Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 

Recently uploaded (20)

Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 

Algorithm below--- a) IF n - 0 return 0 (b) IF m - 0 return 0 (c) IF w.docx

  • 1. Algorithm below... a) IF n = 0 return 0 (b) IF m = 0 return 0 (c) IF w 1 = v 1 return 1 + LCS(w 2 ..w n , v 2 ..v m ) (d) Return max(LCS(w 2 ..w n , v 1 ..v m ), LCS(w 1 ..w n , v 2 ..v m ) Solution Let the input sequences be X[0..m-1] and Y[0..n-1] of lengths m and n respectively. And let L(X[0..m-1], Y[0..n-1]) be the length of LCS of the two sequences X and Y. Following is the recursive definition of L(X[0..m-1], Y[0..n-1]). If last characters of both sequences match (or X[m-1] == Y[n-1]) then L(X[0..m-1], Y[0..n-1]) = 1 + L(X[0..m-2], Y[0..n-2]) If last characters of both sequences do not match (or X[m-1] != Y[n-1]) then L(X[0..m-1], Y[0..n-1]) = MAX ( L(X[0..m-2], Y[0..n-1]), L(X[0..m-1], Y[0..n-2]) Examples: 1) Consider the input strings “AGGTAB” and “GXTXAYB”. Last characters match for the strings. So length of LCS can be written as: L(“AGGTAB”, “GXTXAYB”) = 1 + L(“AGGTA”, “GXTXAY”) 2) Consider the input strings “ABCDGH” and “AEDFHR. Last characters do not match for the strings. So length of LCS can be written as: L(“ABCDGH”, “AEDFHR”) = MAX ( L(“ABCDG”, “AEDFHR”), L(“ABCDGH”, “AEDFH”) ) /* Returns length of LCS for X[0..m-1], Y[0..n-1] */ int lcs( char *X, char *Y, int m, int n ) {
  • 2. if (m == 0 || n == 0) return 0; if (X[m-1] == Y[n-1]) return 1 + lcs(X, Y, m-1, n-1); else return max(lcs(X, Y, m, n-1), lcs(X, Y, m-1, n)); }