## Deleting a binary tree using the delete keyword

A recursive and a non-recursive program to delete an entire binary tree has already been discussed in the previous posts. In this post, deleting the… Read More »

A recursive and a non-recursive program to delete an entire binary tree has already been discussed in the previous posts. In this post, deleting the… 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 tree and 3 nodes a, b and c, the task is to find a node in the tree such that after removing… Read More »

Given a binary tree, print the level order traversal in such a way that first two levels are printed from left to right, next two… Read More »

Given a root node to a tree, find the sum of all the leaf nodes which are at maximum depth from root node. Example: 1… Read More »

Given a binary tree, flatten it into linked list in-place. Usage of auxiliary data structure is not allowed. After flattening, left of each node should… Read More »

Given a binary tree and the two nodes say ‘a’ and ‘b’, determine whether two given nodes are cousins of each other or not. Two… Read More »

Given two binary trees, the task is to check whether the two binary trees is a mirror of each other or not. Mirror of a… Read More »

Given a binary tree. The task is to check if the binary tree is sorted level-wise or not. A binary tree is level sorted if… Read More »

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

Given a binary tree, change the value in each node to sum of all the values in the nodes in the right subtree including its… 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, the task is to find the distance between two keys in a binary tree, no parent pointers are given. Distance between… Read More »

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

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