I have written the Code for forming a binary tree using level order given in an array but since we are not given either a termination condition, how do we approach to create the binary tree
How to take input
you have to take input in level order traversal
-1 is used as termination
in queue only those node are inserted which exist
so at end when q is empty your tree is completed
take a look at code snippet given below
if you want to ask something about this feel free to ask
i hope this helps
if yes show your response with
and don’t forgot to mark doubt as resolved
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.