Overview
Binary lifting stores the 2^k ancestor of each node, letting LCA queries raise nodes to equal depth and then jump upward together.
Answers tree ancestor queries by precomputing powers-of-two jumps.
Compact metadata for implementation and discovery.
Binary lifting stores the 2^k ancestor of each node, letting LCA queries raise nodes to equal depth and then jump upward together.
Quick facts
Runtime and memory behavior at a glance.
Best
O(log n)
Average
O(log n)
Worst
O(log n)
Space
O(n log n)
up[v][j] = up[up[v][j - 1]][j - 1]Builds each larger jump from two smaller jumps.
Highlight active nodes, discovered edges, and the graph structure produced by each step.
Binary Lifting LCA should be used with the assumptions and tradeoffs of tree Query Preprocessing in mind.
What each reference supports for this entry.
Textbook support for Binary Lifting LCA's standard algorithm design, invariants, and complexity analysis.
Open sourceAlgorithm catalog support for Binary Lifting LCA's problem context, known alternatives, and practical selection tradeoffs.
Open sourceGood next jumps from the relationship graph, ranked for useful discovery.
Binary lifting and Euler tours are common alternative preprocessings for tree ancestor queries.