Given coordinates of data centers (an array of points on a 2D plane), find the minimum length of cable required to connect all data centers.
Example:
DC1 (0, 0)
DC2 (1, 0)
DC3 (0, 1)
DC4 (-1, 0)
DC5 (0, -1)
Possible solutions:
- Connect the four outer points through the center: cost = 4 (optimal)
- A non-optimal connection: cost = 2 * sqrt(2) + 2
This problem is a classic minimum spanning tree question on points in a 2D plane. Each data center is a node, and the cable length between two centers is the Euclidean distance. The goal is to connect all nodes with the minimum total cable length, which is typically solved with MST algorithms such as Prim's or Kruskal's. In the example, using the center as a hub gives the optimal total cost of 4, while other connection patterns are longer.