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

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.

## Print a path from Root to Node in Binary Tree

Objective: Given a Binary tree (Not binary Search Tree ), Print a path from root to a given node.

Input: A binary tree, a node x

Output: Path from root to a given node

Example : Approach :

## In a Binary Tree, Create Linked Lists of all the nodes at each depth.

Objective: Given a Binary tree create Linked Lists of all the nodes at each depth , say if the tree has height k then create k linked lists.

NOTE : This problem is very similar “Print binary tree, each level in one line

Input: A binary tree

Output: K linked lists if the height of tree is k. Each linked list will have all the nodes of each level.

Example:

## Level Order Traversal, Print each level in separate line.

Objective: Given a Binary tree , Print each level of a tree in separate line.

NOTE : This problem is very similar ” Create Linked Lists of all the nodes at each depth “

Input: A binary tree

Output: Each level of binary tree, in one line

Example:

## Find the Maximum Depth OR Height of a Binary Tree

Objective: Given a binary tree, find the height of it

Input: A Binary Tree

Output: Height of a binary tree

Example: Approach: