Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer question c 1. Given two strings a1a2an asil b1b2,bm, find their minimus enit distabre. The elit distance is the number of maiematelus in

please answer question c
image text in transcribed
1. Given two strings a1a2an asil b1b2,bm, find their minimus enit distabre. The elit distance is the number of maiematelus in an alignanent. For example, the mininaum edit distance between the two string "SUNNY" and "SNOWY" in the following aligument is 3 : Likewise, the minimum edit distabre between "INTENTION" and "EXECUTION" is 5. (a) Fieprexent the minimum edit distance between a1a2ak and b1b2bt by a function name. (b) Every function has variable(s). Now, it is time to deride oe them, ty which you can sarrow down the problem into sub-problens. This is usually straightforwari, sinee the finuction's variahiles ronatly correppond to the problem's input variable(s) of indions that make it easier to construet mualler sub-probleme. For exatuple, the matrix indices in the Matrix duain Multipuication, the index of the last item we coasider and the weight capacity in the Kmapack, or the lengths of the two soquences in Longent Counusa Suberquence etc. However, there are no variables related to the three posible weights (is. 1,4,5) but enly the weight capacity in the unhoruded Knagsark bexause the wrights are constants given to the problem. Write down the variables of your function in between parenthenis and defiee what your ftenction represents as rounglute and concise as poodble in anly one sentenee, at we did in chass (e. Gives in string X,ofbengthi and Cotamon Suberpacnes problera.) NamaO fYourFunction(.....) (c) We cat start writing the right-hand side of the formulation in a recurive maaner. Now spend a convilerable ansotat of tine to imagine bow wotal an optimal aliganacat would look libe for two arhitrary strings. Vos. it as actaally two strings that are pleced obe abowe the other and expabded at sotine locations with a. Consider the last chodo you moald do to obtaln this lamaghative optimal solution. Yos, yoal afe righa! Yos! must choose what to put as two last characters. Here, there cal he three differest scrarios, where the 31. senario has two subrases: (1) (2) (3) (noma2 In the first stemario, assume that the eqit distano is minimiodl if only you dotr't put any of the first atring's letters, bet just pat a ' Sor the first stribg and put the scoond atring s last ketuer. Given this awsusption, write dows the sul-peobldan you ausat oohe (Le. the same fustion with slighaly different rariabkon). Then, if the last alignanent was an in the first soraario, the right-lanul side would be some function of the function you have written for the corresponding sul-probin. Write down the right-hand side for the lirst scenario. NameO fyourFwntion(.....) =+1 (d) In the scood scenario, assunse that the edit distance is minimiared if only yot doe't put any of the seconul string's letters, bot juas pat a "for the secoud string and put the first string's last letter. Given thas variables). Tben, if the lost alignancut was as in the seconil senario, the right-hand saile wonld be some fienction of the fubetion you have written for the coerexpondiag sab-peoblem. Write down the righte-tand side for the seconal scenario. (e) In the third senario, nasiane that the edit distance is minauized if only you pat the lat letten froat both stringe. Given thas assiamptiva, write down the sub-peollen you aust solve (i.e, the saene fusttion with slightly difereat variabilos). Then, if the last alsgnenent was as is the thirel scehario, the right-hand side would be some function of the function you have writtes for the correrponding sab-problen. This fuanction hiss two legs the one where the last letters are uot the saboe, and the oue where the last lettern are not the same. Write down the right-hand sile for the third scenario. NamnOfYourFuntion (..)=. (f) Actually, we do not do amy choice in dynambe progrananing. What we nant do is first to consider all poosibllitbs like above aad chowe the maiainam of thoos right-hand sides. Now you are ready to minimie them. Write down the whole formulation which collects all the above right-hand side functions into one as a minimization function. NamaO fYuurFinartiou(.....) =

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analytics And Quality Management Fundamental Tools

Authors: Joseph Nguyen

1st Edition

B0CNGG3Y2W, 979-8862833232

More Books

Students also viewed these Databases questions