Question: (Longest common subsequence) A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the
(Longest common subsequence) A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. Longest common subsequence (LCS) of 2 sequences is a subsequence, with maximal length, which is common to both the sequences. For example: of x=abcdefgh, then aceg is a subsequence of x. The longest common subsequence of x and y=jabjdjje is abde. Given two sequence of integers x, of length n, and y, of length m, find the length of their longest common subsequence. Also: output one of them. Complexity: O(n^2).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
