2020-06-22 01:45:24 +00:00
|
|
|
---
|
2020-06-22 19:59:16 +00:00
|
|
|
id: bin-jump
|
2020-06-22 01:45:24 +00:00
|
|
|
title: "Binary Jumping"
|
|
|
|
author: Benjamin Qi
|
2020-06-22 19:59:16 +00:00
|
|
|
description: Introduces the problems of finding level ancestors in a tree and computing the lowest common ancestors.
|
2020-06-22 01:45:24 +00:00
|
|
|
---
|
|
|
|
|
2020-06-24 20:50:30 +00:00
|
|
|
<problems-list>
|
|
|
|
<problem name="Planet Queries I" cses="1750" difficulty="Easy" tags={["Binary Jumping"]}>
|
|
|
|
</problem>
|
|
|
|
<problem name="Company Queries I" cses="1687" difficulty="Easy" tags={["Binary Jumping"]}>
|
|
|
|
</problem>
|
|
|
|
<problem name="Company Queries II" cses="1688" difficulty="Easy" tags={["LCA"]}>
|
|
|
|
</problem>
|
|
|
|
</problems-list>
|
2020-06-22 01:45:24 +00:00
|
|
|
|
2020-06-24 20:50:30 +00:00
|
|
|
## Binary Jumping
|
2020-06-22 01:45:24 +00:00
|
|
|
|
|
|
|
## Lowest Common Ancestor
|
|
|
|
|
|
|
|
### Tutorial
|
|
|
|
|
2020-06-23 01:00:35 +00:00
|
|
|
- CPH 18.1, 18.3
|
2020-06-24 20:50:30 +00:00
|
|
|
- [cp-algorithms](https://cp-algorithms.com/)
|
2020-06-23 02:17:59 +00:00
|
|
|
|
|
|
|
<optional-content title="Improvements">
|
|
|
|
|
|
|
|
- [CF: $O(\log N)$ queries and $O(N)$ memory](https://codeforces.com/blog/entry/74847)
|
|
|
|
- [Wikipedia: $O(1)$ queries and $O(N)$ preprocessing time](https://en.wikipedia.org/wiki/Level_ancestor_problem#Ladder_algorithm)
|
|
|
|
- though explanation is not the greatest
|
|
|
|
|
|
|
|
</optional-content>
|
2020-06-22 01:45:24 +00:00
|
|
|
|
|
|
|
### Problems
|
|
|
|
|
2020-06-24 20:50:30 +00:00
|
|
|
<problems-list>
|
|
|
|
<problem name="Distance Queries" cses="1135" difficulty="Easy" tags={["LCA"]}>
|
|
|
|
</problem>
|
|
|
|
<problem name="Plat - Max Flow" usaco="576" difficulty="Easy" tags={["LCA"]}>
|
|
|
|
</problem>
|
|
|
|
<problem name="Root LCA Queries" csa="root-lca-queries" difficulty="Normal" tags={["LCA"]}>
|
|
|
|
</problem>
|
|
|
|
<problem name="Planets Queries II" cses="1160" difficulty="Normal" tags={["LCA"]}>
|
|
|
|
</problem>
|
|
|
|
<problem name="Plat - Disruption" usaco="842" difficulty="Normal" tags={["LCA"]}>
|
|
|
|
</problem>
|
|
|
|
<problem name="Hot & Cold" dmoj="bts17p7" difficulty="Normal" tags={["LCA"]}>
|
|
|
|
</problem>
|
|
|
|
<problem name="Plat - Tree Boxes" usaco="948" difficulty="Hard" tags={["LCA"]}>
|
|
|
|
- interactive!!
|
|
|
|
</problem>
|
|
|
|
<problem name="Plat - Newbarns" usaco="817" difficulty="Hard" tags={["Diameter"]}>
|
|
|
|
Copy of [CF Brain Network "Hard"](https://codeforces.com/contest/690/problem/C3)
|
|
|
|
</problem>
|
|
|
|
<problem name="Plat - Gathering" usaco="866" difficulty="Hard" tags={["LCA"]}>
|
|
|
|
- interactive!!
|
|
|
|
</problem>
|
|
|
|
<problem name="Plat - Exercise" usaco="901" difficulty="Very Hard" tags={["LCA"]}>
|
|
|
|
</problem>
|
|
|
|
</problems-list>
|