I cannot figure out why I am getting wrong answer for third testcase. Pls check the code https://ide.codingblocks.com/s/106542
Structurally identical (binary tree) third testcase
Hello @urvigoel26,
I guess that you have not understood the question properly.
You have to check if two tree are structurally identical or not.
Example 1:
10 true 20 true 40 false false true 50 false false true 30 true 60 false false true 73 false false
10 true 20 true 40 false false true 50 false false true 30 true 53 false false true 73 false false
Example 2:
10 true 20 true 40 false false true 50 false false true 30 true 60 false false true 73 false false
10 true 20 true 40 false false true 50 false false true 30 true 60 false false true 73 false false
Your program is printing false for first and true for second, though both are structurally identical.
It means that you need not to check for the equality of their node’s data.
Hope, this would help.
Give a like, if you are satisfied.