Showing posts from 2013

## Sum of nodes at each level of binary tree in Java

Topics covered 1. Sum of nodes at each level of binary tree 2. Complete sample program Problem Statement :- Find sum of nodes at each level of binary tree . Sum of nodes at each level of binary tree:-    12 41 66 232 Algorithm : Traver…

## Zigzag level order traversal of binary tree in Java

Problem statement:- Traverse given binary tree alternatively left to right and right to left.In following diagram, LtoR represents : visit nodes from left to right in that level, similarly RtoL : visit nodes from right to left in that level. Read leve…

## Find sum of all elements of binary tree in Java - Iterative and recursive

Topics covered 1. Sum of nodes of binary tree -Iterative 2. Sum of nodes of binary tree -Recursive 3. Complete sample program Problem Statement :- Find sum of all nodes of binary tree. Sum of nodes of binary tree :-  351 Sum of nodes …

## Find level with maximum sum in binary tree - display nodes and sum both

Problem statement :- For a given binary tree, find level with maximum sum and display all nodes at level level. For above binary tree: maximum sum recorded for 11, 991, 12  and maximum sum is 1014 Algorithm: - Do level order traversal with markin…