# Category: Recursion

## Construct a binary tree from given Inorder and Postorder Traversal

Objective: – Given a inorder and postorder traversal, write an algorithm to construct a binary tree from that. This problem was asked in the Microsoft coding competition. Input: Inorder and postorder traversals Similar Problems:...

## Print the Vertical Sum in binary Tree .

Objective: – Given a binary tree, print it in vertical order sum What is Vertical Order Sum as you can see in the example above, [4],[2], [12],[3],[7] are the vertical order sum of the...

## Print the Binary Tree in Vertical Order Path.

Objective: – Given a binary tree, print it in vertical order path. What is Vertical Order as you can see in the example above, [4],[2], [1,5,6],[3],[7] are the verical order of the given binary...

## Lowest Common Ancestor in a Binary Tree (Not Binary Search Tree).

Objective: – Find the Lowest Common Ancestor of two given nodes in a Binary Tree What is Lowest Common Ancestor In a given binary tree, The lowest common ancestor of two nodes n1 and...

## Lowest Common Ancestor in a Binary Search Tree.

Objective: – Find the Lowest Common Ancestor of two given nodes in a Binary Search Tree What is Lowest Common Ancestor In a given binary tree, The lowest common ancestor of two nodes n1...

## Make a Binary Tree from Given Inorder and Preorder Traveral.

Objective: – Given a inorder and preorder traversal, construct a binary tree from that. Input: Inorder and preorder traversals Similar Problem: Construct a binary tree from given Inorder and Postorder Traversal Approach: int []...

## Given a binary tree, find out the maximum sum of value from root to each leaf.

Objective: – Find the maximum sum leaf to root path in a Binary Tree. Means in all the paths from root to leaves, find the path which has the maximum sum. Input: A binary...

## Reverse Alternate levels of a given Binary Tree.

Objective: – Reverse Alternate levels of a given binary tree Input: A binary tree Example: Appraoch:

## Given a Sorted Singly Linked List Array, Convert it into a Balanced Binary search Tree.

Objective: You have been given a sorted singly List, you need to convert it into balanced binary search tree. Why balanced binary tree is important: You can also create first node as root and...

## Given a binary tree, Print All the Nodes that don’t have Siblings.

Objective: Given a binary tree, Print All the Nodes that don’t have siblings. Note: sibling node is the node which has the same parent, so you need to print the nodes who is a...

## Convert a Sorted Doubly Linked List to Balanced BST.

Objective: Given a sorted doubly linked list, convert it into Balanced binary search tree Input: A Doubly Linked List Example: Approach:

## Given a binary tree, Find the Maximum Path Sum between Any Two Leaves

Objective: Given a binary tree, Find the maximum path sum from one leaf node to another. Input: A binary tree. Example: Approach:

## Print Left View of a given binary tree

Objective: In a Binary Tree, print left view of it Input: A binary tree. What is left View of a binary Tree When just look at the tree from the left side , all...

## Print Right View of a given binary tree

Objective: In a Binary Tree, print right view of it Input: A binary tree. What is Right View of a binary Tree? When just look at the tree from the right side , all...

## In a Binary Tree, Check if Two nodes has the same parent or are siblings

Objective: In a Binary Tree, Check if Two nodes has the same parent or are siblings Input: A binary tree and two nodes Example: Approach: