This is my solution actually I m unable to get how to make the tree-like what should be the value at tree [index] which depends upon tree[2index] and tree[2index+1] . Please make changes in my code.
Not getting the Solution
@souravmunjal2000 Hey here is the code for reference.
In segment trees the main question is always about what you store in the node and how you combine two node, rest of the code more or less remains same every where.
In tree node we are storing the number represented by that binary positions
Now when we combine two node its like left shifting the value represented by left child and adding the right childs
If this resolves your doubtmark it 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.