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

Intersection of two Linked Lists in Java

7 years ago Lalit Bhagtani 0
Intersection of two Linked Lists in Java :-  You have given two linked list, create a linked list containing elements that are same in both linked list excluding duplicates. i.e. create intersection of two given linked list. Order of elements in new linked list does not matter. You can see union here, Union of two Read More

Union of two Linked Lists in Java

7 years ago Lalit Bhagtani 0
Union of two Linked Lists in Java :-  You have given two linked list, create a linked list containing all the elements of the given two linked list excluding duplicates. i.e. create union of two given linked list. Order of elements in new linked list does not matter. You can see intersection here, Intersection of two Read More