Skip to content

Tag Archives: Tree Traversals

Given a N ary Tree consisting of N nodes, the task is to find the minimum distance from node A to node B of the… Read More
Given a generic tree consisting of N nodes, the task is to find the maximum sum of the path from the root to the leaf… Read More
Given a Generic Tree consisting of N nodes, the task is to find the left and right views of the given generic Tree. Examples: Input:… Read More
Given a Binary tree, and target sum as K, the task is to print all the possible paths from root to leaf that has the… Read More
Given a Binary Tree, the task is to print the Bottom-left to Upward-right Traversal of the given Binary Tree i.e., the level order traversal having… Read More
Given a Binary Tree consisting of N nodes having values in the range [0, N – 1] rooted as 0, an array wt[] of size… Read More
Given a Binary Tree, the task is to construct an array such that ith index of the array contains GCD of all the nodes present… Read More
Given an N-ary tree consisting of N nodes, the task is to find the node having the largest value in the given N-ary Tree. Examples:… Read More
Given a Binary Search Tree consisting of N nodes and two positive integers L and R, the task is to find the sum of values… Read More
Given a Binary Tree consisting of N nodes, the task is to find the number of paths from the root to any node X, such… Read More
Given a binary tree consisting of N nodes, the task is to replace each node in the binary tree with the sum of its preorder… Read More
Given an N-ary tree consisting of N nodes having values 0 to (N – 1), the task is to find the total number of subtrees… Read More
Given a Binary Tree consisting of N nodes and a integer K, the task is to find the depth and height of the node with… Read More
Given an infinite complete binary tree rooted at node 1, where every ith node has two children, with values 2 * i and 2 *… Read More
Given a Binary Tree consisting only ‘(‘ and ‘)’ a level is considered to be balanced if the nodes of the level having parenthesis are… Read More