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

## Find n-th node of inorder traversal

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

## Delete leaf nodes with value as x

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 »

## Right view of Binary Tree using Queue

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 »

## Remove nodes on root to leaf paths of length < K

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 »

## Construct Tree from given Inorder and Preorder traversals

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 »

## Inorder Tree Traversal without recursion and without stack!

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 »

## Inorder Tree Traversal without Recursion

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 »

## If you are given two traversal sequences, can you construct the binary tree?

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 »

## Convert a Binary Tree into its Mirror Tree

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 »

## Write a program to Delete a Tree

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 »

## Write a Program to Find the Maximum Depth or Height of a Tree

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 »

## Write Code to Determine if Two Trees are Identical

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 »

## Tree Traversals (Inorder, Preorder and Postorder)

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 »