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

# Tag Archives: Tree Traversals

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

Given a Binary Tree, the task is to remove all the subtrees that do not contain any odd valued node. Print the Levelorder Traversal of… Read More

Given a binary tree consisting of either 1 or 0 as its node values, the task is to find the sum of all vertical levels… Read More

Given two arrays Node_ID[] and Parent_ID[]., construct a binary tree where value of ith node is equal to Node_ID[i] and parent of ith node is… Read More

Given a Generic Tree consisting of N nodes (rooted at 0) where each node is associated with a value, the task for each level of… Read More

Given a binary tree, the task is to print all the nodes of the binary tree in Pre-order, Post-order, and In-order iteratively using only one… Read More

Given a Binary Tree and an integer target, denoting the value of a node, the task is to find the sum of distances of all… Read More

Given a binary tree consisting of N nodes, the task is to find the sum of depths of all subtree nodes in a given binary… Read More

Given a 2D array edges[][] of type { X, Y } representing that there is an edge between the node X and Y in a… Read More

Given a Binary Tree, the task is to replace the value of each node with the sum of all the nodes present in the same… Read More