An online placement forum.

You are not connected. Please login or register

LCA (least common ancestor)

Go down  Message [Page 1 of 1]

1 LCA (least common ancestor) on Wed Oct 12, 2011 9:55 pm

Given a binary tree and 2 nodes , find the least common ancestor.
( assume that both the nodes are present in the given tree )

Other Variants:
1. What if the binary tree is a binary search tree ?
2. What if the assumption, regarding the presence of both the nodes (whose LCA is to be found), is removed ? How would the code change in case of a binary tree as well as a binary search tree ?

View user profile

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum