Groups
Category
Rerooting (a.k.a. 换根 DP) computes a per-node answer as if each node were the root, in total O(n) time on trees.
A segment tree is a complete binary tree that stores information about array intervals to answer range queries and support point updates in O(log n).