How can i take input in this case ,since input consists of true and false value
Hello @shubhankar1996.dob1 you can form the tree i.e if there is true value then you will attach the data value to the corresponding side otherwise if it is fase then you will attach null value.
try to go in this way:
in this you can make the build function in which you will give two conditions one for when the string is true and the other for false when the it has no child.
when it has no child you will simple attach null to it but when it has child then you will form the node for the data value and then you will check for the child strings of and then pass them to attach at the left and right following the same criteria mentioned above.
Here for your reference i am attaching the code:https://ide.codingblocks.com/s/397075
if you have any doubt you can ask here;
Happy Learning!!
Here for your reference i am attaching the code:
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.