## Search the Element in a binary tree – With and Without Recursion

Objective: Given a binary tree and a given number x, Write a recursive algorithm to search the element in the … Read more

## Breadth-First Search/Traversal in a Binary Tree

Breadth-First Search ( or Traversal) is also known as Level Order Traversal. What is Breadth First Search: Breadth-first search (BFS) … Read more

## Find the Deepest Left Node in a Binary Tree.

Objective: – Given a binary tree, Find the deepest left node in it. Approach: This approach is very similar to … Read more

## Find the Max element in a Given Binary Tree

Objective: â€“ Given a binary tree , Find the max element in it. Example: Approach: Use Recursion. Max will the Max(root, max … Read more

## Populate Next Siblings Pointers in a Given Binary Tree OR Populate Next Right Pointers in Each Node

Objective: – Given a binary tree with three-pointers left, right, and nextSibling). Write the program to provide the nextsibling pointers.

This problem can also be referred as “Populating Next Right Pointers in Each Node

Example:

Approach:

## Check If One Binary is Mirror Tree of another Binary Tree.

Objective: – Given two binary trees check if they are a mirror images of each other.

Example:

Approach:

## Print All Paths From Root In a Binary Tree Whose Sum is Equal to a Given Number

Objective: – Given a binary tree and X, write an algorithm to Print all the paths starting from root so that sum of all the nodes in the path equals a given number.
Example:

## Diameter Of a Binary Tree

Objective: – Given a binary tree, write an algorithm to find the diameter of the tree.

What is Diameter Of a Tree: Diameter of tree is defined as A longest path or route between any two nodes in a tree. The path may or may not for through the root.

Example:

Approach:

## Find the Deepest Node in a Binary Tree.

Objective: – Given a binary tree, write an algorithm to Find the deepest node in it.

Approach:

• Take two global variables as “deepestlevel” and “value”.
• starting with level=0, Do the inorder traversal and whenever you go down one level ( root.left OR root.right), increase the level by 1.
• Keep checking if deepestlevel < level, if yes then update the “deepestlevel ” and “value “.
• At the end return “value”, which will be the deepest node value.
• See the code for a better explanation.

## Print All The Full Nodes in a Binary Tree

Objective: Given a binary tree, print all nodes will are full nodes. Full Nodes: Nodes Which has both the children, … Read more

## Print the Bottom View of the Binary Tree.

ObjecÂ­tive: Given a binary tree, print it in Bottom View of it.

What is Bottom View: Bottom view means when you look the tree from the bottom the nodes you will see will be called the bottom view of the tree. See the examÂ­ple below.

as you can see in the example above,8, 4, 9, 5, 3, 7 is the bottom view of the given binary tree.