Computer Science, asked by kirtitripathi1061, 11 months ago

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.

Answers

Answered by hidendncr
0

Answer:

A SumTree is a Binary Tree where the value of a node is equal to sum of the nodes present in its left subtree and right subtree. An empty tree is SumTree and sum of an empty tree can be considered as 0.

Explanation:

iven a Binary Tree, print it's left view. Left view of a Binary Tree is a set of nodes visible when tree is seen from the left side .

A node's "parent" is a node one step higher in the hierarchy (i.e. closer to the root node) and lying on the same branch. ... A node that is connected to all lower-level nodes is called an "ancestor". The connected lower-level nodes are "descendants" of the ancestor node.

(mark me as brainlist)

Similar questions