# Tagged: Intermediate

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

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

## In a Binary Tree, Check if two nodes are Cousins

Objective: Given a binary tree and two nodes, Check if they are cousins Input: A binary tree and two nodes Cousin Nodes: Cousin nodes are the nodes who are at the same level in...

## Print Paths from root to all leaf nodes in a binary tree.

Objective: Given a binary tree, Print paths from root to all leaf nodes Input: A binary tree Example: Approach:

## Sort an Given Array in the order defined by another array

Objective: Given an array of integers, write an algorithm to sort it according to the order defined by another array. Input: An Array of Integers Example: Input Array : 2 6 9 1 4...

## Sort an Array such that the odd numbers appear first followed by the even numbers . The odd numbers in ascending order and the even numbers in descending order.

Objective: Given an array of intergers, sort it such that the odd numbers appear first followed by the even numbers . The odd numbers in ascending order and the even numbers in descending order....

## Print All Nodes Between Two Given Levels

Objective: Given a binary Tree and two levels, Print all the nodes between those. Input: A Binary Tree and two levels. Output: Print all the nodes between given levels. Example:

## Find the maximum width of a binary tree

Objective: Given a binary Tree, write an algorithm to find the maximum width. Note: Maximum width of a tree is nothing but the Max(nodes at each level). Input: A Binary Tree Output: Maximum width...

## Find the number of occurrences of a number in a given sorted array.

Objective: Given a sorted(ascending order) arrays of integers, find out the number of occurences of a number in that array Input: A sorted array arrA[] and a number x. Output: number of occurrences of...