OpenGenus / cosmos

World's largest Contributor driven code dataset | Used in Quark Search Engine, @OpenGenus IQ, OpenGenus Visual Project
http://internship.opengenus.org
GNU General Public License v3.0
13.56k stars 3.67k forks source link

Lowest Common Ancestor Algorithms #6785

Open berkay-top opened 1 month ago

berkay-top commented 1 month ago

This is a(n):

Details:

The lowest common ancestor of two nodes of a rooted tree is the lowest node whose subtree contains both the nodes. A typical problem is to efficiently process queries that ask to find the lowest common ancestor of two nodes. I want to implement two solutions for that problem. One with binary lifting and one with sparse table in C++.