in particular field there are trees an single row left to right has value v cut trees to right each tree value that cut (v+1)%m trees on the right most end the value ranging from o to (V+1)%m)-1 on the trees value 2 find the trees values no present after cutting k trees
Answers
Answered by
31
Answer:
Convert a given tree to its Sum Tree
Given a Binary Tree where each node has positive and negative values. Convert this to a tree where each node contains the sum of the left and right sub trees in the original tree. The values of leaf nodes are changed to 0.
For example, the following tree
10
/ \
-2 6
/ \ / \
8 -4 7 5
should be changed to
20(4-2+12+6)
/ \
4(8-4) 12(7+5)
/ \ / \
0 0 0 0
Explanation:
I think it help you thank you please mark me as brainliest answer please tap on it
Similar questions
Social Sciences,
29 days ago
English,
29 days ago
Math,
1 month ago
Science,
9 months ago
Math,
9 months ago