How can I store this given sample input ?
Merge the tree (sample input )
You can build it like this
you have to use same logic as done in level order traversal
Yeah well, thanks for quick response.
5 3 6 2 4
2 1 3 N N N 7 6
This is the given sample inputs, And according to your code, we cant distinct this two different tree inputs, your code return only one tree, while we have to need two different tree,so that we could merge them.
And how we store these inputs in two different tree, this was my question.
okay i understand your problem
so you have to store take both trees as two strings
and then use above approach to build tree
i will send you code wait
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.
How to build two different trees?