Skip to content

Add Lowest common ancestor algorithm #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 21, 2017
Merged

Add Lowest common ancestor algorithm #60

merged 3 commits into from
Feb 21, 2017

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants