LCS in dynamic programming.
Anybody have idea about longest subsequence problem of dynamic programming.
😒😒😒
Member • Jun 16, 2010
Member • Jun 17, 2010
what it means.sushant005longest common sub sequence with greater length as the output.
Member • Jun 17, 2010
Member • Jun 17, 2010
mohit007kumar00what it means.
suppose an example.
AGGA is a longest common subsequence of x = AGCGA and y = CAGATAGAG.
where i use this.
Member • Jun 17, 2010
suppose we have to calculate lcs of "class" and "cboy".sushant005LCS as the name suggest that our optimal solution would be longest common sub sequence notice the term longest. As we all know that Dynamic programming is bottom to up approach so first we have find the all possible solutions of the given problem then we have to choose the best one called as optimal solution to the problem.
Same here, here we have many solutions of greater as well as smallest length but our optimal solution is only the sub sequence with the greatest length.
I think now you got it!
Member • Jun 17, 2010
I want to know the use of lcs.where it is used?sushant005
where i use this means.
Member • Jun 17, 2010
Here there are only one matching i.e c between two strings you mentioned "class" and "cboy".mohit007kumar00suppose we have to calculate lcs of "class" and "cboy".
then how many possible solutions are there please write the solutions.
Member • Jun 17, 2010
LCS is generally used in DNA matching,file comparison etc.mohit007kumar00I want to know the use of lcs.where it is used?
Member • Jun 17, 2010
comman word is always the shortest among them then what is the means of this line.sushant005Here there are only one matching i.e c between two strings you mentioned "class" and "cboy".
Member • Jun 17, 2010
Member • Jun 18, 2010
Yes, Mohit you are very right that common word is always the shortest but here our aim is to find the solution to the problem with greatest length.There is procedure to find the solution to the problen is crealy given in Cormen, follows the steps given in Cormen you will surely get it...mohit007kumar00comman word is always the shortest among them then what is the means of this line.
"optimal solution is only the sub sequence with the greatest length" .