Can anyone help me come up with a solution to this problem I found in my textbook please?

imgur: the simple image sharer

Thanks!

Printable View

- October 19th 2013, 08:40 AMDonna654An efficient algorithm that finds subsequences?
Can anyone help me come up with a solution to this problem I found in my textbook please?

imgur: the simple image sharer

Thanks! - October 19th 2013, 05:24 PMSlipEternalRe: An efficient algorithm that finds subsequences?
Start with any algorithm that gives the correct answer. Figure out where inefficiency arises and alter the algorithm to reduce it. Depending on the definition your book gives for "efficient", this may require several attempts until you get an efficient algorithm.

Example: If the length of a is smaller than the length of b, have the algorithm return the result when the sequences are swapped. Then, find the longest subsequence of that is also a subsequence of . Then, proceed to add digits to the sequence until is a subsequence in its entirety.

This algorithm is not well defined, but it gives a basic idea of the process. It is probably extremely inefficient, since finding the longest subsequence of that is also a subsequence of requires checking all possible subsequences of one of the two and comparing it to the other.