Lowest Common Ancestor (LCA) and Common Ancestors Algorithm in Python with Visualization
This repository contains an implementation of the Lowest Common Ancestor (LCA) algorithm and a tool to find all common ancestors of two nodes in a binary tree. The LCA of two nodes is the deepest node that is an ancestor of both nodes, while the common ancestors are all the nodes that are ancestors of both nodes.
Features:
Implements the LCA algorithm using Python
Supports finding all common ancestors of two nodes in a binary tree
Includes a visualization tool to display the tree and highlight the LCA and common ancestors
Works for both rooted and unrooted trees