edited by
329 views
0 votes
0 votes
The length of the longest common subsequence of $L = ( 1,0,0,1,0,1,0,1 )$ and  $K =( 0,1,0,1,1,0,1,1,0 )$ is __________.
edited by

2 Answers

Best answer
3 votes
3 votes

It might be helpful to solve LCS problem.

There are only three steps-

1)when either M=0 or N=0 means nothing to be match so value 0

2)From both string if matched then 1+LCS(M-1,N-1) means in table it will take value from (M-1,N-1)diagonal value +1.

3)no matching then it will take maximum value from either upper row element or immediate  left element.

selected by
1 votes
1 votes
The longest sub sequences will be

101101

101010

 

both of them are of length 6.
edited by
Answer:

Related questions

2 votes
2 votes
2 answers
2
Bikram asked May 26, 2017
371 views
Assume Dijkstra's Algorithm is used to find the shortest paths from node G in the above graph. The total number of edges which are not included in any of the shortest pat...
1 votes
1 votes
2 answers
3
Bikram asked May 26, 2017
487 views
The total number of LCS (Longest Common Subsequences) of $P = abcd123$ and $Q= badc321$ that can be formed are ______.
0 votes
0 votes
1 answer
4
Bikram asked May 26, 2017
333 views
Consider the following instance of the knapsack problem :$\begin{array}{|c|c|c|c|c|c|} \hline \text{Item} & a & b & c & d & e \\ \hline \text{Benefit} & 15 & 12 & 9 & 16 ...