https://ide.codingblocks.com/s/226140 The sum is calculated correctly but i m not able to take input pls tell how to do it
PLS resolve as soon as possible
@Madhavendra-Gupta-2240591552663161 you are told that first root is given, then number of children (in preorder form, ie root, left, right). So for input
1 2
2 2
3 0
4 0
5 2
6 0
7 0
2
we make a root 1 and it has 2 children. we call function for left child.
root is 2 and it has 2 children. again calling for left child.
root is 3 and it has 0 children, so we dont call the function, and consequently return to the previous call. now we call for the right child of 2 and so on
I hope you are getting it now.
Pls send me the code im not able to make array
Pls do edit in my code only. Taking input is the only problem
@Madhavendra-Gupta-2240591552663161 https://ide.codingblocks.com/s/226564 i have added a function with the name makeATree() please have a look and let me know if you are still confused.
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.