## Merge Sort in a Linked list

Objective: Given a Linked List, Sort it using merge sort. Example: ->9->3->4->2->5->1 Sorted List: ->1->2->3->4->5->9 Approach: Reference : Merge Sort in array As it Merge sort, we apply the same logic , Divide and...

Skip to content# Category: Recursion

## Merge Sort in a Linked list

## AVL Tree – Insertion

## Construct a binary tree from given Inorder and Level Order Traversal

## Construct Binary Search Tree from a given Preorder Traversal Using Stack (Without Recursion)

## Construct Binary Search Tree from a given Preorder Traversal using Recursion

## Print The Top View of a Binary Tree

## Construct a Binary Tree from Given Inorder and Depth-First-Search.

## Depth First Search/Traversal in Binary Tree

## Inorder Predecessor and Successor in Binary Search Tree

## Print All The Nodes Which are X distance from the Given Node

## Print All The Nodes Which are X distance from the Leaf Nodes

## Print All The Nodes Which are X distance from the Root

## Find the Distance between Two Nodes of a Binary Tree.

## Find The Distance From Root To Given Node of a Binary Tree.

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

@tutorialhorizon

Objective: Given a Linked List, Sort it using merge sort. Example: ->9->3->4->2->5->1 Sorted List: ->1->2->3->4->5->9 Approach: Reference : Merge Sort in array As it Merge sort, we apply the same logic , Divide and...

What is AVL Tree : AVL tree is widely known as self-balancing binary search tree. It is named after its creator (Georgy Adelson-Velsky and Landis’ tree). In AVL Tree, the heights of child subtrees...

Objective: – Given a inorder and level order traversal, construct a binary tree from that. Input: Inorder and level order traversal Approach: int[] inOrder = { 4, 2, 5, 1, 6, 3, 7 };...

Objective: – Given a preorder traversal, construct BST from that, without using recursion. Input: Preorder traversal Similar Problem : This problem is similar to the Construct Binary Search Tree from a given Preorder Traversal...

Objective: – Given a preorder traversal, construct BST from that. Input: Preorder traversal Similar Problem : This problem is similar to the – Construct Binary Search Tree from a given Preorder Traversal Using Stack...

Objective: – Given a binary tree, print it in Top View of it. What is Top View: Top view means when you look the tree from the top the nodes you will see will...

Objective: – Given a inorder and preÂorder traÂverÂsal, conÂstruct a binary tree from that. Input: Inorder traversal and Depth-First-Search. Approach: int[] inOrder = { 8, 4, 2, 5, 1, 6, 3, 7, 9 }; int[]...

Objective: – Given a Binary Search Tree, Do the Depth First Search/Traversal . Appraoch: Approach is quite simple, use Stack. First add the add root to the Stack. Pop out an element from Stack...

Objective: – Given a Binary Search Tree, Find predecessor and Successor of a given node. What is Predecessor and Successor : When you do the inorder traversal of a binary tree, the neighbors of...

Objective: – Given Binary Tree, Print All The Nodes Which are X distance from the Given Node. Example : Approach: Quite Tricky solution, i will explain using the example given in the picture.

Objective: – Given Binary Tree, Print All The Nodes Which are X distance from the Leaf Nodes Example : Approach:

Objective: – Given Binary Tree, Print all the nodes which are X distance from the root Example : Appraoch:

Objective: – Given nodes in a binary tree, find the distance between them. Example : Approach:

Objective: – Find The Distance From Root To Given Node of a binary tree. What does Distance means : It means number of edges between two nodes. Approach:

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:...

%d bloggers like this: