Find the largest common subtree of given two binary trees
Ex:
Tree1:
6
5 4
1 8 7 2
9 3
0 10
Tree2:
5
1 4
9 7 2
6 10
output tree:
5
1
9
10
Common subtree can be matched at any level of the tree, and it is need not to match exact as long as left or right subtree can be matched and it needs to be new tree generated not just the root.
PS: I could not find this question anywhere on the coding web sites, if any one find some where please provide link here.
Thanks!