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

2. Minimum Cost to Connect PointsYou are given a set of n points on a 2D 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 (x1, y1) and (x2, y2) is the Manhattan distance |x1- x2|+|y1- y2|.Input: 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!