2020-06-04 01:42:57 +00:00
|
|
|
---
|
2020-06-15 23:19:07 +00:00
|
|
|
id: mst
|
2020-06-05 00:21:03 +00:00
|
|
|
title: "Minimum Spanning Trees"
|
2020-06-04 02:09:42 +00:00
|
|
|
author: Benjamin Qi
|
2020-06-05 00:21:03 +00:00
|
|
|
prerequisites:
|
|
|
|
-
|
|
|
|
- Gold - Shortest Paths
|
2020-06-04 01:42:57 +00:00
|
|
|
---
|
|
|
|
|
2020-06-16 17:09:59 +00:00
|
|
|
**Disjoint Set Union** and **Minimum Spanning Trees**
|
2020-06-04 05:39:49 +00:00
|
|
|
|
|
|
|
<!-- END DESCRIPTION -->
|
2020-06-03 20:56:04 +00:00
|
|
|
|
2020-06-04 21:42:30 +00:00
|
|
|
## Standard
|
2020-06-03 23:03:14 +00:00
|
|
|
|
2020-06-03 21:08:42 +00:00
|
|
|
- [Kattis Minimum Spanning Tree](https://open.kattis.com/problems/minspantree)
|
2020-06-04 21:42:30 +00:00
|
|
|
- same as [CSES Road Reparation](https://cses.fi/problemset/task/1675)
|
2020-06-03 20:56:04 +00:00
|
|
|
|
|
|
|
## Tutorial
|
|
|
|
|
2020-06-04 21:42:30 +00:00
|
|
|
- CPH 15 (Spanning Trees)
|
2020-06-03 20:56:04 +00:00
|
|
|
- Prim's Algorithm
|
2020-06-03 21:42:26 +00:00
|
|
|
- [cp-algo](https://cp-algorithms.com/graph/mst_prim.html)
|
2020-06-03 20:56:04 +00:00
|
|
|
- Similar to Dijkstra
|
|
|
|
- Kruskal's Algorithm
|
2020-06-03 21:42:26 +00:00
|
|
|
- [cp-algo 1](https://cp-algorithms.com/graph/mst_kruskal.html)
|
|
|
|
- [cp-algo 2](https://cp-algorithms.com/graph/mst_kruskal_with_dsu.html)
|
2020-06-03 20:56:04 +00:00
|
|
|
- Requires "Disjoint Set Union" (DSU) data structure
|
2020-06-03 23:03:14 +00:00
|
|
|
- [CSAcademy Disjoint-Set](https://csacademy.com/lesson/disjoint_data_sets)
|
2020-06-04 21:42:30 +00:00
|
|
|
- [Topcoder Union Find](https://www.topcoder.com/community/data-science/data-science-tutorials/disjoint-set-data-structures/)
|
|
|
|
- [CPC.3](https://github.com/SuprDewd/T-414-AFLV/tree/master/03_data_structures)
|
2020-06-03 20:56:04 +00:00
|
|
|
- DSU Complexity Proofs (optional of course)
|
|
|
|
- [log\*n](https://en.wikipedia.org/wiki/Proof_of_O(log*n)\_time_complexity\_of_union%E2%80%93find)
|
|
|
|
- [a(m,n)](https://dl.acm.org/doi/pdf/10.1145/321879.321884)
|
|
|
|
|
|
|
|
## USACO Gold Problems
|
|
|
|
|
2020-06-04 02:09:42 +00:00
|
|
|
- MST
|
2020-06-03 20:56:04 +00:00
|
|
|
- [Walk](http://usaco.org/index.php?page=viewproblem2&cpid=946)
|
|
|
|
- Prim's is applicable, but the edge weights are special so you don't actually need to use an MST algo ...
|
|
|
|
- [Fencedin](http://www.usaco.org/index.php?page=viewproblem2&cpid=623)
|
|
|
|
- also special ...
|
2020-06-04 02:09:42 +00:00
|
|
|
- DSU
|
2020-06-03 20:56:04 +00:00
|
|
|
- [Mootube](http://www.usaco.org/index.php?page=viewproblem2&cpid=789)
|
2020-06-03 23:03:14 +00:00
|
|
|
- same as [CSES Road Construction](https://cses.fi/problemset/task/1676)
|
2020-06-03 20:56:04 +00:00
|
|
|
- [Closing the Farm](http://www.usaco.org/index.php?page=viewproblem2&cpid=646)
|
|
|
|
- [Favorite Colors](http://www.usaco.org/index.php?page=viewproblem2&cpid=1042)
|
2020-06-04 21:42:30 +00:00
|
|
|
- fairly tricky
|
|
|
|
|
|
|
|
## Other Problems
|
|
|
|
|
|
|
|
- [Birthday Gifts](https://www.hackerearth.com/practice/math/combinatorics/inclusion-exclusion/practice-problems/algorithm/mancunian-and-birthday-gifts-d44faa15/) [](73)
|
2020-06-08 19:51:58 +00:00
|
|
|
- [Spanning Tree Fraction](https://www.hackerrank.com/contests/w31/challenges/spanning-tree-fraction) [](78)
|