JIGYASA

An online placement forum.


You are not connected. Please login or register

Closest Common ancestor

Go down  Message [Page 1 of 1]

1 Closest Common ancestor on Sun Sep 12, 2010 6:48 am

Lucifer


Admin
Given 2 nodes(say, pointer to the node is given) in a binary tree, find the closest common ancestor.

Code:

    Input:
                                1
              2                                  3
      4                5                  6              7
  8        9      10        11        12      13    14      15

Output:
Closest Common ancestor :
              (9,11) -> 2
              (9,14) -> 1

View user profile http://jigyasa.forumn.org

Back to top  Message [Page 1 of 1]

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