Based on various comments I think folks do not consider B in the path from A
to C which leads to the LCA solution.
@SVIX, one can implement the tree with a parent pointer in each node but
that doesn't matter in the general case.
What you are essentially saying is: consider the tree to be a directed graph
with parent -> child link to be one way, if that were the case we cannot
even
reach from A to C so that is out of question that's why we consider it to be
a both way link.
Now given this one can always argue that B lies in the path from A to C!
i.e. A->D->M->B->M->C
so here we can, perhaps, define a shortest path from A to C and it has to go
through LCA.

@all
guys, one request please use @XYZ in case you are referring to a particular
post by the person XYZ unless it is a general comment.
just to avoid confusion.



On Tue, Jan 11, 2011 at 8:06 PM, juver++ <[email protected]> wrote:

> The tree can be unrooted. Although, in any tree there is unique path from
> one node to another. Not only from the parent to childs.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Man goes to doctor. Says he's depressed. Says life seems harsh and cruel.
Says he feels all alone in a threatening world where what lies ahead is
vague and uncertain. Doctor says "Treatment is simple. Great clown
Pagliacci is in town tonight. Go and see him. That should pick you up." Man
bursts into tears. Says "But, doctor...I am Pagliacci."

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to