This repository has been archived on 2022-06-22. You can view files and clone it, but cannot push or open issues or pull requests.
usaco-guide/content/6_Plat/1_Plat_Trees.md
2020-06-15 16:19:07 -07:00

85 lines
No EOL
2.3 KiB
Markdown

---
id: trees
title: "Trees"
author: Benjamin Qi
prerequisites:
-
- Silver - Depth First Search
---
Lowest Common Ancestor and other tree topics.
<!-- END DESCRIPTION -->
## Tree Diameter
### Tutorial
- CPH 14.2
### Problems
- [USACO Plat Newbarns](http://www.usaco.org/index.php?page=viewproblem2&cpid=817)
- Copy of [Brain Network "Hard"](https://codeforces.com/contest/690/problem/C3)
- [Tree Construction](https://csacademy.com/contest/archive/task/tree-construct)
## Lowest Common Ancestor
### Tutorial
- CPH 18
- [cp-algorithms: Lowest Common Ancestor](https://cp-algorithms.com/)
### Problems
USACO:
- [USACO Plat Max Flow](http://www.usaco.org/index.php?page=viewproblem2&cpid=576)
- [USACO Gold Milk Visits](http://www.usaco.org/index.php?page=viewproblem2&cpid=970)
- [USACO Gold Cow Land](http://www.usaco.org/index.php?page=viewproblem2&cpid=921)
- LCA + BIT
- [USACO Plat Promote](http://www.usaco.org/index.php?page=viewproblem2&cpid=696)
- Subtree + BIT
- [USACO Plat Disrupt](http://www.usaco.org/index.php?page=viewproblem2&cpid=842)
- HLD is possible, but just do binary jumps
- [USACO Plat Tree Boxes](http://www.usaco.org/index.php?page=viewproblem2&cpid=948)
- interactive!!
- [USACO Plat Gathering](http://www.usaco.org/index.php?page=viewproblem2&cpid=866)
- [USACO Plat Exercise](http://www.usaco.org/index.php?page=viewproblem2&cpid=901)
- tricky
Other:
- [Hot & Cold](https://dmoj.ca/problem/bts17p7) [](105)
- [Root LCA Queries](https://csacademy.com/contest/archive/task/root-lca-queries/) [](107)
## Centroid Decomposition
### Tutorial
- [GeeksForGeeks](http://www.geeksforgeeks.org/centroid-decomposition-of-tree/)
- [Carpanese](https://medium.com/carpanese/an-illustrated-introduction-to-centroid-decomposition-8c1989d53308)
### Problems
- [USACO Plat - At Large](http://www.usaco.org/index.php?page=viewproblem2&cpid=793)
- very tricky
- [DMOJ Bob Equilibrium](https://dmoj.ca/problem/dmopc19c7p6)
## Heavy-Light Decomposition
- probably not intended solution, but can help (ex. for "Disrupt")
### Tutorial
- [Anudeep2011](https://blog.anudeep2011.com/heavy-light-decomposition/)
- [AI-Cash](http://codeforces.com/blog/entry/22072)
- [adamant](https://codeforces.com/blog/entry/53170)
### Problems
??
## Small to Large (Offline)
??