Structurally Identical *BINARY TREE"

I’m not able to understand this question, kindly explain?

hello @CODER_JATIN

in the question we just have to check whether the two given binary tree are identical in structure or not .

ss
example of structurally identical tree (note their data need not to be same ,but there strucutre must remain same).

okay and bhaiya ye kis form mai input de rkha hai? … 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 Sample Output

tumko preorder taveral diya hua hai , jisme jo numbers hai wo node ka data bata raha hai aur jo true aur false hai wo ye indicate kar rahe hai ki child node exisit karta hai ya nahi.

image

first read root node.
then check whether left subtree exist or not by reading a string .
if it is true that means left subtree exist ,so build left tree recursively
otherwise assign NULL to left of current node.

again read one more string to check whether right subtree exist or not.
if it exist(string is true) then build it recursively
otherwise
assign NULL to right of current node

and at the end return current node

THIK HAI BHAIYA , SMJH GYA YE TO, THANK YOU :slight_smile:

lekin bhaiya , fir to har ek no input lene ke baad 2 string input honi chahiye naa?

2 lagatar ho wo jaruri nahi hai ,kyunki preoder traversal diya hua hai.
to current data ,phir ek string agar wo true ha to phir left tree ka data aana suru ho jayega

thik hai thik hai bhaiya , samajh gya :slight_smile:

https://ide.codingblocks.com/s/435927 , bhaiya check karna code 2 test cases ni chal rhe

chnage ur base case.
u need to handle cases weere one node is null but other node is not null.

thik hai bhaiya , done hai ab :slight_smile: , thank you’

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.