Minimum Network Cost
Return the minimum cost to connect all points, where connecting two points costs their Manhattan distance (a minimum spanning tree).
Requirements
- Prim's algorithm on the complete graph: .
Examples
EXAMPLE WALKTHROUGHclassic
A guided view of the published example, not a trace of your code.
INPUT
[[[0,0],[2,2],[3,10],[5,2],[7,0]]]TASKminimum_network_cost()
EXPECTED OUTPUT
20Start with the input values shown in this example.
Example 1 of 3
Input: points = [[0,0],[2,2],[3,10],[5,2],[7,0]]
Output: 20
Explanation: classic
Input: points = [[3,12],[-2,5],[-4,1]]
Output: 18
Explanation: three points
Input: points = [[0,0]]
Output: 0
Explanation: single point
Hint 1
Keep the cheapest known connection cost for each point not yet in the tree and add the cheapest one each step.