##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Spanning trees connect all nodes with minimum edges. Learn Kruskal's and Prim's algorithms.
(Why we need MSTs)
(Definition and properties)
(Minimum total edge weight)
Foundation for MST algos
(Avoiding unnecessary edges)
(Sort edges, add greedily)
(Detecting cycles efficiently)
(Sorting dominates)
(Step-by-step implementation)
(Grow tree from one node)
(Finding lightest edge fast)
(Heap operations dominate)
(Step-by-step implementation)
(Choosing the right algorithm)
(Handling multiple components)
CSES 1675 - MST or impossible
(CSES 1675)
(MST needs connected graph)
(Sort edges, union components)
(Count edges added)
(Kruskal with edge count)
(CSES 1675)
(Example execution)
(When MST doesn't exist)
LeetCode 1584 - Complete gr...
(LeetCode 1584)
(n² edges to consider)
(Computing edge weights)
(Compute edges as needed)
(Prim with lazy heap)
(LeetCode 1584)
(Example execution)
(Implicit vs explicit graphs)
CSES 1666 - MSF for components
(CSES 1666)
(DSU or DFS)
(Chain them together)
(DSU then connect)
(DSU and component list)
(CSES 1666)
(Example execution)
(MST ideas without weights)
(When is MST unique?)
(Almost minimum spanning tree)
(Real-world applications)
Knowledge check
Knowledge check
(What you learned)