Question: 2 . Minimum Cost to Connect PointsYou are given a set of n points on a 2 D plane. Each point is represented by its
Minimum Cost to Connect PointsYou are given a set of n points on a D plane. Each point is represented by its coordinates x y You need to connect all the points with edges, such that the total cost of connecting all points is minimized. The cost of connecting two points x y and x y is the Manhattan distance x xy yInput: The first line contains an integer n the number of points. Each of the next n lines contains two integers x and y the coordinates of the points.Output: Print the minimum total cost to connect all points.
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
