report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
Module Lowest common ancestor (LCA)

Lowest common ancestor (LCA)

**Frequency: 8/10** In many cases where a problem involves querying a path on a tree, there is a high likelihood that the Lowest Common Ancestor (LCA) will be a crucial element in the solution. There are also a lot of problems involving LCA in the next module, Euler tour.

Resources

- [CP Algorithms: Lowest Common Ancestor - Binary Lifting](https://cp-algorithms.com/graph/lca_binary_lifting.html)

Problems

LCA 696 / 703 1300
Distance query 610 / 625 1400
Robot on tree 525 / 552 1400
Heaviest edge 489 / 496 1500
Equal path 376 / 397 1500
Triplet 347 / 352 1500
Path update 387 / 397 1600
Second best minimum spanning tree 199 / 306 1700
Oggy and the cockroaches 85 / 119 1800

Graph

  • Shortest path
  • 0-1 BFS / Dial's algorithm
  • Multisource BFS / Dijkstra
  • DAG / Topological sort

Data structure

  • Introduction to Segment Tree and Binary Indexed Tree
  • Sparse table
  • Monotonic queue

Tree

  • Lowest common ancestor (LCA)
  • Euler tour

Dynamic Programming

  • Bitmask DP
  • Exchange labels DP
  • Game DP

Math

  • Introduction to combinatorics
  • Inclusion-exclusion principle