# Tag Archives: Tree Traversals

Given a binary tree, the task is to print all the nodes of the binary tree in Pre-order, Post-order, and In-order in one iteration. Examples:… Read More
Given a Binary Tree and an input array. The task is to create an Iterator that utilizes next() and hasNext() functions to perform Inorder traversal… Read More
Given a Binary Search Tree consisting of N distinct nodes, the task is to flatten the given Binary Search Tree to convert the tree into… Read More
Given a Binary Search Tree, the task is to create a wave array from the given Binary Search Tree. An array arr[0..n-1] is called a… Read More
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