Structurally Identical tree


HOW Can i remove run error in this?

@minal.251298,

https://ide.codingblocks.com/s/224431 corrected code.
Make binary tree as a private class in Main class. Because the code was not taking input for the second tree.

Also in the identical method, don’t compare the data of nodes as it is given in the question: They may or may not have the same data though.

Rest everything is correct.

Is there any other way to remove run error?

@minal.251298,
It was mostly related to the input. You can try other methods too. Your logic was correct. The problem was the second tree wasn’t been created.

Okkk okkk thank you so much

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.