Which of the following is the longest common subsequence of the sequences and ?

Which of the following is the longest common subsequence of the sequences <h, i, n, d, u, i, s, t, a, n> and <i, n, d, i, a, n>? Correct Answer &lt;i, n, d, i, a, n&gt;

Concept:-

Longest common subsequence:- If a set of sequences are given, the longest common subsequence problem is to find a common subsequence of all the sequences that are of maximal length. 

Subsequence:- Let us consider a sequence S = < s1, s2, s3, ......, sn >

A sequence Z = < z1, z2, z3, ........, zm > over S is called a subsequence of S, if and only if it can be derived from S deletion of some element.

Common subsequence:- Suppose, X and Y are two sequences over a finite set of elements. We can say that Z is a common subsequence of X and Y if Z is a subsequence of both X and Y. 

Analysis:-

Here given two sequences,

Let X = < h, i, n, d, u, i, s, t, a, n>

      Y = < i, n, d, i, a, n > and

Let Z be a common subsequences of X and Y,

      Z = < i, n, d, i, a, n >

[ alt="F1 Harshita 09-2-22 Madhuri D1" src="//storage.googleapis.com/tb-img/production/22/02/F1__Harshita_09-2-22_Madhuri_D1.png" style="width: 214px; height: 116px;">

Hence the longest common subsequence of the given sequence is < i, n, d, i, a, n >. 

Related Questions

Which of the following methods can be used to solve the longest common subsequence problem?
Longest common subsequence is an example of ____________