Tag Archives: tree-traversal

Given a Binary Tree, the task is to find the smallest subtree that contains all the deepest nodes of the given Binary Tree and return… Read More
Given a Binary Tree, the task is to remove the leaf nodes of the Binary Tree during each operation and print the count. Examples: Input:  … Read More
Given an N-ary tree rooted at 1, the task is to assign values from the range [0, N – 1] to each node in any… Read More
Given a Binary Search Tree, the task is to print the nodes of the BST in the following order: If the BST contains levels numbered… Read More
Given a Tree with N nodes values from 1 to N and N – 1 edges. The task is to find the maximum matching in… Read More
Given a Binary Tree and an integer D, the task is to check if the distance between all pairs of the same node values in… Read More
Given a Generic tree, the task is to delete the leaf nodes from the tree.  Examples: Input: 5 / / \ \ 1 2 3… Read More
Given a Binary Tree, the task is to find it’s Triple Order Traversal.  Triple Order Traversal is a tree traversal technique in which every node… Read More
Given a binary tree consisting of N nodes, the task is to print the nodes that are just above the leaf node.Examples: Input: N =… Read More
Given a Binary Tree and a positive integer K. The task is to check whether the Balanced BST of size K exists in a given… Read More
Given a binary tree, the task is to print the longest path from the root node to the leaf node. If there are multiple answers… Read More
Double Threaded Binary Search Tree: is a binary search tree in which the nodes are not every left NULL pointer points to its inorder predecessor… Read More
Given a binary tree, the task is to traverse the Binary Tree in level order fashion. Examples: Input: 1 / \ 2 3 Output: 1… Read More
Given a tree with N nodes value from 0 to (N – 1) and a 2D array arr[][] of size dimensions 3xN, where arr[i][j] denotes… Read More