Skip to content

Tag Archives: Preorder Traversal

Let us discuss the Time and Space complexity of different Tree Traversal techniques, such as Inorder Traversal, Preorder Traversal, Postorder Traversal, etc. Time Complexity of… Read More
Given an N-ary tree root, the task is to check if it is symmetric horizontally (Mirror image of itself). Example: Input:   root =     … Read More
Given root of the Binary Tree T and a linked list L, the task is to find the direction of path followed from root such… Read More
Given two arrays pre[] and in[] representing the preorder and inorder traversal of the binary tree, the task is to check if the given traversals… Read More
Given a binary tree consisting of N nodes, the task is to split the binary tree into two subtrees by removing one edge such that… Read More
Given an array pre[], representing the Preorder traversal of a Perfect Binary Tree consisting of N nodes, the task is to construct a Perfect Binary… Read More
Given a Binary Tree consisting of N nodes, the task is to replace each node of the tree with the product of all the remaining… 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 a Binary Tree with each node representing an alphabet, the task is to find lexicographically smallest palindromic root to leaf path. If no palindromic… 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, the task is to print all possible root-to-leaf paths having a maximum number of even valued nodes. Examples: Input:  2 /… Read More
Given a Binary Tree, the task is to count the number of nodes in the given Binary Tree such that the path from the root… Read More
Given a Binary Tree consisting of N nodes rooted at 1, an integer K and an array arr[] consisting of values assigned to each node,… Read More