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

# Tag Archives: Tree Traversals

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

Given an N-ary Tree consisting of N nodes valued from [1, N], where node 1 is the root, the task is to count the pairs… Read More

Given a Binary Tree consisting of N nodes, the task is to replace all the nodes that are present at even-numbered levels in a Binary… Read More

Given a binary tree, the task is to print the inorder traversal of the modified tree obtained after shifting all the nodes of the given… Read More

Given a Binary Tree consisting of nodes with values 0 and 1 only, the task is to find the total sum of the decimal equivalents… Read More

Given a binary tree consisting of N nodes, the task is to check if the nodes in the top view of a Binary Tree forms… Read More