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

- Construct a BST from given postorder traversal using Stack
- Remove BST Keys in a given Range
- Product of all leaf nodes of binary tree
- Check if two nodes are in same subtree of the root node
- Sum of all the Boundary Nodes of a Binary Tree
- Clockwise Spiral Traversal of Binary Tree | Set - 2
- Count all pairs of adjacent nodes whose XOR is an odd number
- Iterative program to find distance of a node from root
- Reverse Anti Clockwise Spiral Traversal of a Binary 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 »

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 »

Given 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, print Right view of it. Right view of a Binary Tree is set of nodes visible when tree is visited from… 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 »

It depends on what traversals are given. If one of the traversal methods is Inorder then the tree can be constructed, otherwise not. Therefore, following… Read More »

Mirror of a Tree: Mirror of a Binary Tree T is another Binary Tree M(T) with left and right children of all non-leaf nodes interchanged.… Read More »

To delete a tree we must traverse all the nodes of the tree and delete them one by one. So which traversal we should use… Read More »

Given a binary tree, find height of it. Height of empty tree is 0 and height of below tree is 3. Example Tree Recommended: Please… Read More »

Two trees are identical when they have same data and arrangement of data is also same. To identify if two trees are identical, we need… Read More »

Unlike linear data structures (Array, Linked List, Queues, Stacks, etc) which have only one logical way to traverse them, trees can be traversed in different… Read More »