Graph Theory37 sections · 1633 units
Open in Course

Lessons Learned

(Full tour power)

Full Euler tour with RMQ solves LCA in O(1)O(1) or O(log⁡n)O(\log n) per query. This is one of the standard LCA algorithms. Other LCA methods include binary lifting (O(log⁡n)O(\log n) per query with simpler code) and Tarjan's offline algorithm (O(1)O(1) amortized but requires knowing all queries upfront).

Choose based on constraints: full tour for online queries with fast responses, binary lifting for simpler implementation.