Trees: Lowest Common Ancestor
What is the Lowest Common Ancestor? In a tree, the lowest common ancestor (LCA) of two nodes, n1 and n2, is the shared ancestor located farthest from the root and has both n1 and n2 as descendants. Properties of the Lowest Common Ancestor: An LCA can be one of the input nodes themselves if one […]
May 30, 2023 | Data Structure | No comments