Question: Given a 2 binary trees root nodes, check if the structure is mirror to each other. Example: Consider the image given below and its mirror. If you can see in the above image, both the trees structure are mirror to each other. We don’t consider …

Consider the below image You need to print the leaf node: Form left to right: 7, 15, 18, 30 Form right to left : 30, 18, 15, 7 Solution in C++ #include <iostream> #include <queue> #include <stack> using namespace std; // structure to hold binary tree …

Question: Given a binary tree root node, get the deepest left leaf node Example: Consider the image given below and its mirror. From the above image, node 7 is the deepest left leaf node. Solution in C++ #include <iostream> #include <queue> #include <stack> using namespace std; …

Problem Statement: You are given a root node, you need to calculate the vertical sum of the tree. Consider the image below Vertical-Line-1: has only one node 7 => vertical sum is 7 Vertical-Line-2: has only one node 10 => vertical sum is 10 Vertical-Line-3: has …

Question: Given a binary tree root node, check if the tree is a isomorphic tree. 2 trees are called isomorphic to each other, if they have same structure or mirror structure. And their data should also match. Solution in C++ #include <iostream> #include <queue> #include <stack> …

Question: Given a binary tree root node, check if the tree is a foldable tree. Example: Consider the image given below We can see that, the nodes of left and right Subtree are exact mirror of each other. So we can solve this problem by using …

Problem Statement: Given a binary tree root node, you need to find the minimum and maximum value of the nodes. Consider the image below: Minimum value is 7 and maximum value is 30. Solution: We can solve this problem by traversing the tree and checking the …