Why it matters
Offline LCA is faster than online for batches.
Advertisement
The architecture
DFS tree.
Union-find as we return from subtrees.
Answer query when both endpoints visited.
Advertisement
How it works end to end
α(n) per query amortized.
Requires all queries upfront.
Applications: batch tree queries.