Sunday, 8 September 2013

A tree having multiple children at any level , find the path between two nodes

A tree having multiple children at any level , find the path between two
nodes

we have a tree having as many children at any level 2 nodes are given and
we have to find the path between two node how can we do that ?
1
/ | \
2 3 4
/\ / | \
5 8 11 12 13
/\ |
6 9 14
/\
7 10
we have to find path between node 7 and 14
it is 7->6->5->2->1->4->12->14

No comments:

Post a Comment