Gold_Graphs
This commit is contained in:
parent
00069f49ad
commit
0d126726b0
|
@ -1,5 +0,0 @@
|
|||
- **Dijkstra**
|
||||
- ex. [Milk Pumping](http://www.usaco.org/index.php?page=viewproblem2&cpid=969)
|
||||
- Floyd-Warshall
|
||||
- Bellman-Ford??
|
||||
- SPFA??
|
|
@ -1,21 +0,0 @@
|
|||
|
||||
- **Dijkstra**
|
||||
- ex. [Milk Pumping](http://www.usaco.org/index.php?page=viewproblem2&cpid=969)
|
||||
- Floyd-Warshall
|
||||
- Bellman-Ford??
|
||||
- SPFA??
|
||||
- CPH 13
|
||||
|
||||
|
||||
- CPH 15
|
||||
- ex. [Fencedin](http://www.usaco.org/index.php?page=viewproblem2&cpid=623)
|
||||
- Prim
|
||||
- Kruskal
|
||||
|
||||
|
||||
- CPH 16
|
||||
- ex. [Timeline](http://www.usaco.org/index.php?page=viewproblem2&cpid=1017)
|
||||
|
||||
- DSU Complexity Proofs
|
||||
- [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)
|
28
content/3_Gold/Gold_MST.md
Normal file
28
content/3_Gold/Gold_MST.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Gold - Minimum Spanning Tree
|
||||
|
||||
* [Kattis Minimum Spanning Tree](https://open.kattis.com/problems/minspantree)
|
||||
|
||||
## Tutorial
|
||||
|
||||
- CPH 15
|
||||
- Prim's Algorithm
|
||||
- Similar to Dijkstra
|
||||
- Kruskal's Algorithm
|
||||
- Requires "Disjoint Set Union" (DSU) data structure
|
||||
- [CSAcademy Disjoint-Set](https://csacademy.com/lessons)
|
||||
- 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
|
||||
|
||||
- MST Problems
|
||||
- [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 ...
|
||||
- DSU Problems
|
||||
- [Mootube](http://www.usaco.org/index.php?page=viewproblem2&cpid=789)
|
||||
- [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)
|
||||
- fairly tricky
|
65
content/3_Gold/Gold_ShortestPath.md
Normal file
65
content/3_Gold/Gold_ShortestPath.md
Normal file
|
@ -0,0 +1,65 @@
|
|||
# Gold - Shortest Path
|
||||
|
||||
Author: Benjamin Qi
|
||||
|
||||
[CPC.7](https://github.com/SuprDewd/T-414-AFLV/tree/master/07_graphs_1)
|
||||
|
||||
## Breadth First Search
|
||||
|
||||
### Tutorial
|
||||
|
||||
- [CSAcademy BFS](https://csacademy.com/lesson/breadth_first_search)
|
||||
- [cp-algo BFS](https://cp-algorithms.com/graph/breadth-first-search.html)
|
||||
- [cp-algo 0/1 BFS](https://cp-algorithms.com/graph/01_bfs.html)
|
||||
|
||||
### Problems
|
||||
|
||||
- [Cow Navigation](http://www.usaco.org/index.php?page=viewproblem2&cpid=695)
|
||||
- [Dream](http://www.usaco.org/index.php?page=viewproblem2&cpid=575)
|
||||
- [Lasers](http://www.usaco.org/index.php?page=viewproblem2&cpid=671)
|
||||
|
||||
## Shortest Path
|
||||
|
||||
### Non-Negative Edge Weights
|
||||
|
||||
* [Kattis SSSP Non-Negative](https://open.kattis.com/problems/shortestpath1)
|
||||
|
||||
For non-negative weights, use *Dijkstra's Algorithm:*
|
||||
|
||||
#### Tutorial
|
||||
|
||||
* CSES 13.2
|
||||
* [cp-algo Dijkstra (Dense Graphs)](https://cp-algorithms.com/graph/dijkstra_sparse.html)
|
||||
* [cp-algo Dijkstra (Sparse Graphs)](https://cp-algorithms.com/graph/dijkstra_sparse.html)
|
||||
* Usually, it's this one that's applicable.
|
||||
|
||||
#### USACO Gold Problems
|
||||
|
||||
* [Milk Pumping](http://www.usaco.org/index.php?page=viewproblem2&cpid=969)
|
||||
* fairly standard application
|
||||
* [Shortcut](http://usaco.org/index.php?page=viewproblem2&cpid=899)
|
||||
* [Fine Dining](http://usaco.org/index.php?page=viewproblem2&cpid=861)
|
||||
|
||||
### All Pairs
|
||||
|
||||
* [Kattis All Pairs Shortest Path](https://open.kattis.com/problems/allpairspath)
|
||||
|
||||
Use the *Floyd-Warshall* algorithm.
|
||||
|
||||
#### Tutorial
|
||||
|
||||
* CSES 13.3
|
||||
* [cp-algo Floyd-Warshall](https://cp-algorithms.com/graph/all-pair-shortest-path-floyd-warshall.html)
|
||||
|
||||
#### USACO Gold Problems
|
||||
|
||||
* [Moortal Cowmbat](http://usaco.org/index.php?page=viewproblem2&cpid=971)
|
||||
* Use APSP before running DP.
|
||||
|
||||
### Negative Edge Weights
|
||||
|
||||
Hasn't appeared in recent USACO Gold as far as I know.
|
||||
|
||||
* [Kattis SSSP Negative](https://open.kattis.com/problems/shortestpath3)
|
||||
|
||||
Can also modify Dijkstra's so it works with negative edge weights but not negative cycles. Running time bound no longer applies.
|
11
content/3_Gold/Gold_TopoSort.md
Normal file
11
content/3_Gold/Gold_TopoSort.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
## Gold - Topological Sort
|
||||
|
||||
### Tutorial
|
||||
|
||||
- CPH 16.1, 16.2
|
||||
- [cp-algorithms](https://cp-algorithms.com/graph/topological-sort.html)
|
||||
|
||||
### USACO Gold Problems
|
||||
|
||||
- [Timeline](http://www.usaco.org/index.php?page=viewproblem2&cpid=1017)
|
||||
- [Milking Order](http://www.usaco.org/index.php?page=viewproblem2&cpid=838)
|
Reference in a new issue