## Count all pairs of adjacent nodes whose XOR is an odd number

Given a Binary Tree as shown below. The task is to count all pair of adjacent nodes whose XOR is an odd number. Explanation: Initially,… Read More »

Given a Binary Tree as shown below. The task is to count all pair of adjacent nodes whose XOR is an odd number. Explanation: Initially,… Read More »

Given a BST and a number. The task is to check whether the given number is equal to the sum of all the node from… Read More »

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… Read More »

Given a BT and a key Node, find the total sum in BT, except those Node which are adjacent to key Node. Examples: Recommended: Please… Read More »

Given a binary tree and a node, print all cousins of given node. Note that siblings should not be printed. Examples: Input : root of… Read More »

Given a binary search tree and a target node K. The task is to find the node with the minimum absolute difference with given target… Read More »

Given a Binary tree and a number N, write a program to find the N-th node in the Preorder traversal of the given Binary tree.… Read More »

Given a binary tree and a node in the binary tree, find Postorder predecessor of the given node. Examples: Consider the following binary tree 20… Read More »

Given two Binary Trees, returns true if two trees are mirror of each other, else false. Mirror Tree : Previously discussed approach is here. Recommended:… Read More »

iven the binary tree and you have to find out the n-th node of inorder traversal. Examples: Input : n = 4 10 / \… Read More »

Given a binary tree and a target integer x, delete all the leaf nodes having value as x. Also, delete the newly formed leaves with… Read More »

Given a Binary Tree and a number k, remove all nodes that lie only on root to leaf path(s) of length smaller than k. If… Read More »

Let us consider the below traversals: Inorder sequence: D B E A F C Preorder sequence: A B D E C F Recommended: Please solve… Read More »

Using Morris Traversal, we can traverse the tree without using stack and recursion. The idea of Morris Traversal is based on Threaded Binary Tree. In… Read More »

Using Stack is the obvious way to traverse tree without recursion. Below is an algorithm for traversing binary tree using stack. See this for step… Read More »