Given two strings, S1 & S2. given scoring scheme where gap penalty, mismatch score and match score.
Find the S1 which have a best match with S2.
My idea is to list all possible S1 and then match one by one with S2. List all possible S1 by using brute force. Then match each possible S1 with S2 by using dp.
Is there is any faster way to do so? or suggest any reference?
Using Wikipedia and a little bit of thinking one could code up something like this:
Output:
I wonder if there’re any bugs (other than the apparent lack of error checking).