Find LCA in n ary tree ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options,
If there are N nodes and it is an n-ary tree, O(N) pre-processing is
required for every node, storing its parent in each step.
Subsequently, if LCA(u,v) is to be found, produce the list of
ancestors A(u) and A(v), which can be done in O(log-n N) steps.
Then compare A(u) and A(v) to find the