newszine

PostOrder Traversal of Tree in Java | Tree Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary tree, return the postorder traversal of its node values. Example  Post order traversal of above binary tree is   Algorithm  Postorder traversal is also known as postfix traversal. In postorder traversal, we recursively process all the nodes of a Read More

Same Tree in Java | Tree Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given two binary trees, find out if both trees are same or not. Two binary trees are same, if they are structurally identical and the nodes have same value. Example  1)  Above two binary trees are structurally same and their node values are also same. 2)  Above two binary trees are Read More

Sum of all Left Leaves in Java | Tree Problem

4 years ago Lalit Bhagtani 0
Problem Statement You have given a binary tree, find out the sum of all left leaves value. Example  There are two left leaves in above binary tree, 9 and 15, So result should be 24. Algorithm  We can use Depth First Traversal algorithm to solve this problem. Program  Result 24 Similar Post Sum of all Read More