## Sort linked list containing 0’s, 1’s and 2’s

Given a linked list containing 0’s, 1’s and 2’s, sort linked list by doing single traversal of it.

Read More Sort linked list containing 0’s, 1’s and 2’sCoding made easy

Given a linked list containing 0’s, 1’s and 2’s, sort linked list by doing single traversal of it.

Read More Sort linked list containing 0’s, 1’s and 2’sFind maximum amount of water that can be trapped within given set of bars. Assume width of each bar is 1 unit.

Read More Trapping Rain Water within given set of barsGiven two sorted array of integers, find a path involving elements of both arrays whose sum is maximum. We can start from either arrays but we can switch between arrays only through its common elements.

Read More Find maximum sum path involving elements of given arraysGiven an array of integers, find contiguous subarray within it which has the largest sum.

Read More Maximum subarray problem (Kadane’s algorithm)Given a limited range array of size n where array contains elements between 1 to n-1 with one element repeating, find the duplicate number in it.

Read More Find a duplicate element in a limited range arrayGiven an array of integers containing duplicates, return the majority element in an array if present. A majority element appears more than n/2 times where n is the size of the array.

Read More Find majority element in an array (Boyer–Moore majority vote algorithm)Given an array containing only 0’s, 1’s and 2’s, sort the array in linear time and using constant space.

Read More Sort an array containing 0’s, 1’s and 2’s (Dutch national flag problem)Given a Binary Tree, determine if it is a BST or not. This problem has a simple recursive solution. The BST property “every node on the right subtree has to be larger than the current node and every node on the left subtree has to be smaller than the current node” is the key …

Read More Determine if given Binary Tree is a BST or notA Binary Search Tree (BST) is a rooted binary tree, whose nodes each store a key (and optionally, an associated value) and each have two distinguished sub-trees, commonly denoted left and right. The tree should satisfy the BST property, which states that the key in each node must be greater than all keys stored …

Read More Insertion in BSTGiven a binary tree, in-place convert it to a Doubly Linked List.

Read More In-place convert convert given Binary Tree to Doubly Linked ListGiven a binary tree, write an efficient algorithm to print all paths from root node to every leaf node in it.

Read More Print all paths from root to leaf nodes in given binary treeGiven a binary tree and two nodes x and y in it, find lowest common ancestor (LCA) of x and y in it.

Read More Find Lowest Common Ancestor (LCA) of two nodes in a binary treeGiven a binary tree, write an efficient algorithm to check if it is symmetric binary tree or not. i.e. left subtree and right subtree are mirror images or each other.

Read More Check if given binary Tree is symmetric or notGiven a binary tree, write an efficient algorithm to compute the diameter of it. The diameter of a binary tree is equal to number of nodes on the longest path between any two leaves in it.

Read More Find diameter of a binary tree