Learn
Practice
Newsletter
Resources
Resume
New
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Min Cost to Connect All Points
Bookmark
Input
Example 1
Example 2
Square
T-Shape
Custom
points
=
[[0,0],[2,2],[3,10],[5,2],[7,0]]
Points & MST Edges
P0
(0,0)
P1
(2,2)
P2
(3,10)
P3
(5,2)
P4
(7,0)
Union-Find Parent Array:
Cost: 0
Legend:
Default
Considering
In MST
Rejected (Cycle)
algo
master
.
io
Step:
Initialize 5 points, 10 possible edges (sorted by cost)
0 / 24
Input
Example 1
Example 2
Square
T-Shape
Custom
points
=
[[0,0],[2,2],[3,10],[5,2],[7,0]]
0 / 24
Points & MST Edges
P0
(0,0)
P1
(2,2)
P2
(3,10)
P3
(5,2)
P4
(7,0)
Union-Find Parent Array:
Cost: 0
Legend:
Default
Considering
In MST
Rejected (Cycle)
algo
master
.
io
Step:
Initialize 5 points, 10 possible edges (sorted by cost)