Given a Binary Tree, find the maximum sum in a binary tree by adding the parent with its children. Exactly three Node needs to be added. If the tree does not have a node with both of its children as not NULL, return 0.
We simply traverse the tree and find the Node that has the maximum sum. We need to take care of the leaves.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Convert an arbitrary Binary Tree to a tree that holds Children Sum Property
- Node having maximum sum of immediate children and itself in n-ary tree
- Check for Children Sum Property in a Binary Tree
- Count nodes with two children at level L in a Binary Tree
- Count of nodes in a Binary tree with immediate children as its factors
- Count of nodes in a Binary Tree whose immediate children are co-prime
- Iterative approach to check for children sum property in a Binary Tree
- Find the parent of a node in the given binary tree
- Sum of all parent-child differences in a Binary Tree
- Construct Binary Tree from given Parent Array representation
- Sum of all the child nodes with even parent values in a Binary Tree
- Find right sibling of a binary tree with parent pointers
- Find parent of given node in a Binary Tree with given postorder traversal
- Lowest Common Ancestor in a Binary Tree | Set 2 (Using Parent Pointer)
- Find Height of Binary Tree represented by Parent array
- Construct Binary Tree from given Parent Array representation | Iterative Approach
- Count all Grandparent-Parent-Child Triplets in a binary tree whose sum is greater than X
- Maximum sub-tree sum in a Binary Tree such that the sub-tree is also a BST
- Maximum XOR path of a Binary Tree
- Maximum spiral sum in Binary Tree
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.