Mission 12: "The Minimum Cost Network" 🔌
To begin Kruskal's algorithm, you must first consider the cheapest connections. Sort all available edges by their weight in ascending order.
00:00
Mission Objective
Given a list of `edges`, where each edge is an array `[u, v, weight]`, sort the list in place based on the weight.
Step 1 / 3
1. The Story: The Mission Briefing
"To power up the entire star map sector, you must connect all systems to the central power hub. The cost of creating a link between any two systems varies. Find the absolute cheapest way to connect all systems together."
2. The Problem
How do you build a Minimum Spanning Tree?
3. The Task
You will implement a Greedy algorithm like Kruskal's. Your code will repeatedly pick the cheapest available connection that doesn't form a loop until all systems are connected, thus finding the minimum total cost.
4. Concepts Applied
Minimum Spanning Tree (MST).