## Sum of all the Boundary Nodes of a Binary Tree

Given a binary tree, the task is to print the sum of all the boundary nodes of the tree. Examples: Input: 1 / \ 2… Read More »

## Check if two nodes are in same subtree of the root node

Given a Binary Tree with distinct nodes. Given two nodes node1 and node2, check if the two nodes lies in the same subtree of the… Read More »

## Remove BST Keys in a given Range

Given a Binary Search Tree (BST) and a range [min, max], remove all keys which are inside the given range. The modified tree should also… Read More »

## Construct a BST from given postorder traversal using Stack

Given postorder traversal of a binary search tree, construct the BST. For example, 1. If the given traversal is {1, 7, 5, 50, 40, 10},… Read More »

## Iterative program to find distance of a node from root

Given the root of a binary tree and a key x in it, find the distance of the given key from the root node. Dis­tance… Read More »

## Product of all leaf nodes of binary tree

Given a binary tree, find the product of all the leaf nodes. Examples: Input : 1 / \ 2 3 / \ / \ 4… Read More »

## 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 »

## Root to leaf path sum equal to a given number in BST

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 »

## Maximum parent children sum in Binary tree

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 »

## Total sum except adjacent of a given node in a Binary Tree

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 »

## Print cousins of a given node in Binary Tree | Single Traversal

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 »

## Find the closest element in Binary Search Tree | Space Efficient Method

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 »

## Find n-th node in Preorder traversal of a Binary Tree

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 »

## Postorder predecessor of a Node in Binary Search Tree

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 »

## Check if two trees are Mirror | Set 2

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 »