Skip to content
CCC Python Course

LCA and binary lifting on trees

Stage
7
Module
M7.13
Lessons
1

In this module

  • Find the lowest common ancestor of two nodes in a tree using binary lifting.
  • Build a sparse table to precompute ancestors at powers-of-two distances.
  • Answer range queries on a tree by lifting up the tree logarithmically.
  • Extend binary lifting to arbitrary weights and node labels.

Before this module

Lessons

  1. 1LCA and binary lifting on trees