Answer:
Each time you insert a new node, call the function to adjust the sum.
This method has to be called each time we insert new node to the tree since the sum at all the
parent nodes from the newly inserted node changes when we insert the node.
// toSumTree method will convert the tree into sum tree.
int toSumTree(struct node *node)
{
if(node == NULL)
return 0;
// Store the old value
int old_val = node->data;
// Recursively call for left and right subtrees and store the sum as new value of this node
node->data = toSumTree(node->left) + toSumTree(node->right);
// Return the sum of values of nodes in left and right subtrees and
// old_value of this node
return node->data + old_val;
}
This has the complexity of O(n).
Explanation:
Answer:
i. This value was not accepted because we have 12 months and not 13.
ii. This is because the user entered the value for the day as value for the month.
Explanation:
i. Why was this not accepted?
This value was not accepted because we have 12 months and not 13. The user entered a value that was above the maximum value registered for the number of months in a year- which is 12.
ii. Why do you think this error occurred
This is because the user entered the value for the day as value for the month.
This could be because the user uses a date system different from that of the program.
Answer:
music
Explanation:
it calms u and takes away all ur worries for that time because ur just vibing
Its the Thigh Bone. Hope this helps. =^-^=
D. mouse that is your answer <span />