💡 Structurally Identical (Binary Tree)

In the problem what is the meaning of true and false.

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
does the true after 10 means there is a node at left of 10?

and also what is the meaning of structurally Identical Trees? Do they need to have the same data?

Hey Prabal, When we say structurally identical trees, we mean that both the trees have exactly the same number of nodes, arranged in the exactly same way. It is not necessary that the data of each node should also be the same.
And yes “10 true 20” represents that 10 has a left node 20.

1 Like

That means if I just iterate over the input and check if in both input trees the true and false appear at same location then can I say the trees are structurally similar?

yes, you just need to check the structure only.

1 Like