Question: The function should look like the one declared below: [ min _ dist, index _ p 1 , index _ p 2 ] = TnC
The function should look like the one declared below:mindist, indexp indexp TnCclosestpairD P P is an array of onedimensional points indexp indexp are the index numbers of two closest points mindist is the distance between Pindexp and PindexpYou will use Transform and Conquer approach for this, ie You will presort the points before applying your algorithm.Paste your code below.Exercise : Run your code on the following input:P ;NOTE: This input is just an example. You will get different values in the actual lab. Write the output of your code below:Exercise :Compare the efficiency of your algorithm with the brute force using following empirical approach:n Implement the brute force algorithm to find the minimum distance between any two points n Implement the transform and conquer algorithm to do the same Exercise aboven Run above two codes on randomly generated different numbers of input points forexample points, points, points, points, points and note down the execution times. Make sure that in each trial you generate a random input and then run both codes on that same input.n Plot the times taken by both algorithms as function of the input size, on the same plot. n Explain the plot which algorithm is faster and why? By java
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
