Structurally identical binary tree(trees)

I did not understand how to interpret the input to a tree.

@bommareddyjyothiswaroopreddy
See there is a base structure to every node. There is its value, it has a left pointer and has a right pointer.
So what you do is first take input for the value of the node, take input into a string. If the string is true, you make a call to construct the left portion of the tree. If it is false, you set the left pointer to NULL. Then you take input into a string again. This is being done to construct the right portion of the tree. The same approach is folowed.

If my answer is able to resolve your query, please mark the doubt as resolved.
Please revert in case you face any query.

1 Like