Synopsys Interview Question

Algo to find if two Binary Trees are structurally equivalent

Interview Answer

Anonymous

Aug 16, 2012

this can be done with just 2 pointers , 1 for each binary tree. make any order traversal in first tree and see weather the same traversal is possible in 2nd tree irrespective of the values present in it... if any of the condition violates, return false... if both reaches NULL at the same time.... return true..