## Level Order Traversal of Binary Tree

Problem: Level order traversal of binary tree. eg. Logic: In level order traversal nodes of tree are traversed level-wise from left to right. Like depth first traversals ( Inorder,preorder and postorder traversal) level order traversal is not easily implemented recursively because… Continue Reading

## Binary Search Tree

A binary tree is a Binary Search tree if and only if: All values in left subtree of a node are less than value in node. All values in right subtree of a node are greater than value in node.… Continue Reading

## 3Sum

Problem: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. eg.  Given… Continue Reading

## Delete value from singly linked list

Problem: Given a Linked List of Integers Delete all nodes that have value x. Logic: The basic thing we need to take into consideration is that given value can be present in a linked list more than once. So we… Continue Reading

## Basic operations on Singly Linked List

We will discuss basic operations on singly linked list. Operations like insert,delete and print. 1. Insert: In singly linked list, last node stores next address value as null. So while inserting new node , linked list is traversed from start… Continue Reading

## Check if Singly Linked list has a cycle

Problem: Checking if linked has a cycle . This means that there will be no ‘null’ value for address pointer in linked list. Logic: I.  Without extra space solution: If  linked list has a cycle then there never going to… Continue Reading