@siddharam:
i think the above example is isomorphic
because in isomopic we check for the degree of each node in one tree to the
corresponding degree of another tree is present or not .
like eg:-
p-q--r---s
is isomorphic with
a--b--c---d
On Thu, Sep
as per your example
preorder inorder
tree1: ab ba
tree2: ab ab
both are not isomorphic.
its easy to extend preorder/DFS to
replace two calls to children with for loop considering the graph is N-array
tree.
Thank you,
Sid.
On Wed, Sep 14, 2011 at 5:50 PM, bugaboo
@siddharam:
Performing inorder and pre/postorder will still have false positives.
Consider 2 trees one with root node "a" with node "b" as left child,
another tree with root node "a" with node "b" as its right child.
Anyway, for binary trees, I am aware of a recursive solution to find
out simila
bharath.sriram,
perform inorder traversal and peorder/postorder traversal on both tree then
compare both the result of two tree.
Thank you,
Sid.
On Wed, Sep 14, 2011 at 10:22 AM, bugaboo wrote:
> This brings up another interesting question. How do you find out if 2
> graphs are identical? (By
This brings up another interesting question. How do you find out if 2
graphs are identical? (By identical, I mean exact similarity and NOT
isomorphism). Clearly, checking to see if both the DFS traversal and
BFS traversal match seem to have false positives as Bharathkumar
mentioned.
On Sep 13, 12: