I am unable to figure out how the tree is constructed from input 1,2,-1,3,-1,-1.
Big Bang Theory Tree Coloring
@akshugoyal705 tree is formed in preorder fashion!
make node for root, then go left, later right, with a base case if(input==-1) then return NULL.
this is incorrect, correct data is 1,2,-1,-1,3,-1,-1
so tree looks like
1
/ \
2 3
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.