Skip to content

Category Archives: Tree

Given a binary tree, the task is to find the maximum width of the given tree. The width of a tree is the maximum of… Read More
Write a program that converts a given tree to its Double tree. To create Double tree of the given tree, create a new duplicate for… Read More
For the below example tree, all root-to-leaf paths are: 10 –> 8 –> 3 10 –> 8 –> 5 10 –> 2 –> 2 Recommended… Read More
Let us consider the below traversals: Inorder sequence: D B E A F C  Preorder sequence: A B D E C F Recommended Practice Construct… Read More
Given a binary tree and a number, return true if the tree has a root-to-leaf path such that adding up all the values along the… Read More
  Using Morris Traversal, we can traverse the tree without using stack and recursion. The idea of Morris Traversal is based on Threaded Binary Tree.… Read More
  In this post, we have seen in detail about the Inorder traversal and how it is implemented using recursion. Here in this post, we… Read More
A height balanced binary tree is a binary tree in which the height of the left subtree and right subtree of any node does not… Read More
The diameter/width of a tree is defined as the number of nodes on the longest path between two end nodes.  The diagram below shows two… Read More
Question: Given an arbitrary binary tree, convert it to a binary tree that holds Children Sum Property. You can only increment data values in any… Read More
Given a binary tree, the task is to check for every node, its value is equal to the sum of values of its immediate left… Read More
Given a Binary Tree, the task is to print the Level order traversal of the Binary Tree in spiral form i.e, alternate order. Example: Input:Output:… Read More
A binary search tree (BST) is a node-based binary tree data structure that has the following properties.  The left subtree of a node contains only… Read More
A node is a leaf node if both left and right child nodes of it are NULL. Here is an algorithm to get the leaf node… Read More
Level Order Traversal technique is defined as a method to traverse a Tree such that all nodes present in the same level are traversed completely… Read More