Its very simple to solve this.
Start from root.
Compare the value of current node data value to both nodes.
1. if both are greater than current node then traverse node->right
2. if both are lesser than current node then traverse node->left
3. else return current node pointer.
Any comments,
Atu
could you please elucidate more??
On Wed, Apr 7, 2010 at 10:34 PM, Himanshu Aggarwal
wrote:
> For a given binary tree, given the root and two node pointers, how can we
> find their youngest common ancestor.
>
> Say the node is like:
>
> struct node{
>int data;
>struct node*left, *
For a given binary tree, given the root and two node pointers, how can we
find their youngest common ancestor.
Say the node is like:
struct node{
int data;
struct node*left, *right;
};
i.e the father field is not there.
Please note that it is not a binary search tree, but just a b
Can any one help me with this problem
Its a divide and conquer problem where, there are n teams and each
team plays each opponent only once. And each team plays exactly once
every day. If n is the power of 2, I need to construct a timetable
allowing the tournament to finish in n-1 days...
An
I have the following situation this year in the Volleyball league:
3 divisions consisting of 12, 16, 16 teams respectively.
We run the league with 4 30 minute slots and I was planning on taking
half of the teams from each division so that would be 6, 8, 8 and
having them play in slot A and the ot