No, it wouldn't; it is just harder to come up with the counter example. The one that pops into my mind is due to the fact that an algorithm that claims to find "the longest common subsequence" will actually find "one of the maximal common subsequences" and you may have needed to find some other one:
axbc
abxc
a1b2c
If the first run picks "axc" then you are doomed. If you get lucky and it picks "abc", then you win.
But I strongly suspect that you don't even need to rely on that quirk. Indeed, I now see that it is easy to extend the above example:
axybc
abxyc
a1b2c
The solution is "abc" but you will first pick "axyc" and so won't include "b" in the final "answer".
|