spoj.pl/problems/BOTTOM

my algo for this prob goes by this way..will this work correctly?

1)first make a bfs from an arbitrary node and store the nodes visited
in order in an array.

2)the node that is visited at the end of the BFS in the 1st bfs is now
taken as the root and then make a BFS from this node and store the
nodes visited in order in an array.

3)reverse the array in step 2

4)find the Longest Common Subsequence between the arrays in step 1 and
step 3

5)if any one of the array is empty,then all the other nodes in the
other array sud b printed.

will this logic work?

any other ideas are welcomed...

praba...

-- 
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