03 Trees and range queries - broyda/cp-lib GitHub Wiki

Notes

95% of question on tress < 1900 can be solved using DFS/BFS and LCA.
Binary Lifting > 2100

Euler tour (flatening a tree) and range queries (segment trees) are required together to solve certain classes of problems.

Perform DFS on particular subtree of the full tree, say from one specific child node off of the root node

Set the root node as the parent of the child node. So this way, even if that node is a neighbor of the child node, DFS will not be performed.