JIGYASA
Would you like to react to this message? Create an account in a few clicks or log in to continue.
JIGYASA

An online placement forum.


You are not connected. Please login or register

LCA (least common ancestor)

Go down  Message [Page 1 of 1]

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

codecrker



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 ?

Back to top  Message [Page 1 of 1]

Similar topics

-

» Closest Common ancestor

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