Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given two strings a 1 a 2 d o t s a n and b 1 b 2 d o t s b m ,
Given two strings and find their minimum edit distance. The edit distance is the number of
mismatches in an alignment. For example, the minimum edit distance between the two strings "SUNNY" and
"SNOWY" in the following alignment is :
Likewise, the minimum edit distance between "INTENTION" and "EXECUTION" is
a Represent the minimum edit distance between and by a function name.
b Every function has variables Now, it is time to decide on them, by which you can narrow down the
problem into subproblems. Although they may seem straightforward, they can be tricky. The function's
variables usually correspond to the indices andor capacities that make it easier to construct smaller sub
problems. For example, the matrix indices in the Matrix chain Multiplication, the index of the last item we
consider and the weight capacity in the Knapsack, or the lengths of the two sequences in Longest Common
Subsequence etc. As an example, however, there are no variables related to the three possible weights ie
but only the weight capacity in the unbounded Knapsack because the weights are constants given
to the problem. Write down the variables of your function in between parenthesis and define what your
function represents as complete and concise as possible in only one sentence, as we did in class eg Given a
string of length i and another string of length represented the length of their longest common
subsequence in the longest Common Subsequence problem.
NameOfYourFunction
c We can start writing the righthand side of the formulation in a recursive manner. Now spend a considerable
amount of time to imagine how would an optimal alignment would look like for two arbitrary strings. Yes,
it is actually two strings that are placed one above the other and expanded at some locations with a
Consider the last choice you would do to obtain this imaginative optimal solution. Yes, you are right! You
must choose what to put as two last characters. Here, there can be three different scenarios, where the
scenario has two subcases:
cdotscdots,
cdotscdots,
In the first scenario, assume that the edit distance is minimized if only you don't put any of the first string's
letters, but just put a for the first string and put the second string's last letter. Given this assumption,
write down the subproblem you must solve ie the same function with slightly different variables Then,
if the last alignment was as in the first scenario, the righthand side would be some function of the function
you have written for the corresponding subproblem. Write down the righthand side for the first scenario.
NameOfYourFunction dotsdots
d In the second scenario, assume that the edit distance is minimized if only you don't put any of the second
string's letters, but just put a for the second string and put the first string's last letter. Given this
assumption, write down the subproblem you must solve ie the same function with slightly different
variables Then, if the last alignment was as in the second scenario, the righthand side would be some
function of the function you have written for the corresponding subproblem. Write down the righthand
side for the second scenario.
NameOfYourFunction dotsdots
e In the third scenario, assume that the edit distance is minimized if only you put the last letters from both
strings. Given this assumption, write down the subproblem you must solve ie the same function with
slightly different variables Then, if the last alignment was as in the third scenario, the righthand side
would be some function of the function you have written for the corresponding subproblem. This function
has two legs: the one where the last letters are not the same, and the one where the last letters are not the
same. Write down the righthand side for the third scenario.
NameOfYourFunction dotsdots
f Actually, we do not do any choice in dynamic programming. What we must do is first to consider all
possibilities like above and choose the minimum of those righthand sides. Now you are ready to minimize
them. Write down the whole formulation which collects all the above righthand side functions into one as
a minimization function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started