Back to Browse

Least Common Ancestor - Dynamic Programming on Graphs

46.4K views
Jul 18, 2017
13:09

We discuss a technique to find the lowest common ancestor between two nodes in a graph using dynamic programming. Finding the LCA of two nodes is a common operation in problems like Heavy Light Decomposition and Euler Tour. This technique is also known as binary lifting. It takes O(logN) time to find an ancestor using this technique. References: https://www.topcoder.com/community/data-science/data-science-tutorials/range-minimum-query-and-lowest-common-ancestor/ http://codeforces.com/blog/entry/43917 Code: https://github.com/gkcs/Competitive-Programming/blob/master/src/main/java/main/java/videos/LCA.java

Download

0 formats

No download links available.

Least Common Ancestor - Dynamic Programming on Graphs | NatokHD