A Link-Cut tree supports:
link(u, v): Make a child of . (Trees must be in different components.)
cut(u): Remove edge from to its parent.
findRoot(u): Find root of 's tree.
pathQuery(u, v): Query aggregate (sum/min/max) on path from to .
pathUpdate(u, v, val): Update all nodes on path from to .
lca(u, v): Find lowest common ancestor. All operations run in amortized time. Time: . Space: .