Question: ( 2 0 pts ) Suppose we are given two arrays x [ 1 . . n ] and y [ 1 . . n
pts Suppose we are given two arrays and of integers. We would like to find a matching between and such that
ano missing every is matched to at least one and every is matched to at least one ;
bno crossing if for matches with and matches with we must have
Your job is to design an time algorithm to find a matching such that the sum of for all matched pairs is minimized. The figure below shows an optimal matching between two given sequences, which yields a sum of Your algorithm only needs to return the minimum sum; the actual matching is not required.
My own solution is converting the relationship into a D map with each cell ij meaning the abs difference of xi and yj then find the solution using minimum cost path finding methodsdynamic programming for minimum cost path finding cost On
well clearly the current solution on this chegg website is incorrect as it first didnt adress how ii and iii is performed and how it avoid crossingrequirement issue.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
