what if the root node has negative value, then also these 4 cases remains the same.
Rot node negative
@Akshay123
yes the cases will remain same. since u r declaring ur max value globally. use will always take maxglobal=max(maxglobal,these 4 cases)
Hope dis helps.
but if root is negative, then why will I ever include root value in any of the case
@Akshay123
u never know that root node will have neg. or positive value assigned to it.
so its better to consider all cases. moreover there might be a subtree in a tree with neg. root node but it children having very big value canceling the effect of neg. subtree root node.
hope dis helps
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.