Skip to content

Conversation

@Hamada14
Copy link

In graph theory and computer science, the lowest common ancestor (LCA) of two nodes v and w in a tree or directed a cyclic graph (DAG) T is the lowest (i.e. deepest) node that has both v and w as descendants, where we define each node to be a descendant of itself (so if v has a direct connection from w, w is the lowest common ancestor).

There's many methods to find the LCA, one can be using Euler tour and a segment tree or by using Binary lifting which is the implemented method.

@xtaci
Copy link
Owner

xtaci commented Jan 10, 2017

please modify your code with OOP concept, and conform to C++11 standards with detailed comments.

@Hamada14
Copy link
Author

Thanks a lot for the advice, I'll divide it into a .h and .cpp and apply OOP concepts 👍

@Hamada14
Copy link
Author

I have confirmed to C++11 standards and added detailed comments describing the flow of the algorithm.

@xtaci xtaci merged commit 50fb4e1 into xtaci:master Feb 21, 2017
@xtaci
Copy link
Owner

xtaci commented Feb 21, 2017

please make changes to README.md too, add entry to your alg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants