## Connect nodes at same level

Write a function to connect all the adjacent nodes at the same level in a binary tree. Structure of the given Binary Tree node is… Read More »

## Check if a binary tree is subtree of another binary tree | Set 1

Given two binary trees, check if the first tree is subtree of the second one. A subtree of a tree T is a tree S… Read More »

## Check if a given Binary Tree is SumTree

Write a function that returns true if the given Binary Tree is SumTree else false. A SumTree is a Binary Tree where the value of… Read More »

## Applications of Minimum Spanning Tree Problem

Minimum Spanning Tree (MST) problem: Given connected graph G with positive edge weights, find a min weight set of edges that connects all of the… Read More »

## Print BST keys in the given range

Given two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Print all the keys of tree… Read More »

## Print Ancestors of a given node in Binary Tree

Given a Binary Tree and a key, write a function that prints all the ancestors of the key in the given binary tree. For example,… Read More »

## Get Level of a node in a Binary Tree

Given a Binary Tree and a key, write a function that returns level of the key. For example, consider the following tree. If the input… Read More »

## Applications of tree data structure

Difficulty Level: Rookie Why Tree? Unlike Array and Linked List, which are linear data structures, tree is hierarchical (or non-linear) data structure. One reason to… Read More »

## Print nodes at k distance from root

Given a root of a tree, and an integer k. Print all the nodes which are at k distance from root. For example, in the… Read More »

## Foldable Binary Trees

Question: Given a binary tree, find out if the tree can be folded or not. A tree can be folded if left and right subtrees… Read More »

## Maximum width of a binary tree

Given a binary tree, write a function to get the maximum width of the given tree. Width of a tree is maximum of widths of… Read More »

## Double Tree

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 »

## Given a binary tree, print all root-to-leaf paths

For the below example tree, all root-to-leaf paths are: 10 –> 8 –> 3 10 –> 8 –> 5 10 –> 2 –> 2 Recommended:… Read More »

## Construct Tree from given Inorder and Preorder traversals

Let us consider the below traversals: Inorder sequence: D B E A F C Preorder sequence: A B D E C F Recommended: Please solve… Read More »

## Root to leaf path sum equal to a given number

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 »