Check if a Tree is Almost Complete Binary Tree

Given a pointer to the root node of the tree, write code to find if it is an Almost Complete Binary Tree or not? A […]

HashMap performance improvement in Java 8

What improvement has java-8 made that performance of HashMap.get() function call is fast by 20% in Java-8.

Separate Chaining: Hashing collision handling technique

It is almost impossible to design a generic hash system without collision. In case of collision, it need to be handled. There are multiple ways […]

Birthday Paradox (Birthday Problem)

You may solve the simple probability, “Given a set of n randomly chosen people, what is the probability of two people having same birthday?” You may also […]

Hashing introduction

Let us design a data structure in which we want to store numbers (taking it for simplicity, else it can be anything). We want to […]

Medicine tablet (Pill) taking puzzle

Doctor gave you two types of medicine tablets (pils) A and B, and asked you to take one from each daily. The two tablets are in […]

Check if two node are siblings in a binary tree

Given a binary tree and two values. Find if these values appear in sibling nodes in the tree. For example, if tree is Then 2 […]

Check duplicate parenthesis in an expression

A valid mathematical expression can also have duplicate parenthesis as shown below: ((a+b)) (((a+(b)))+(c+d)) Write code to find if an expression has duplicate parenthesis. You […]

Next greater element

Print Next Greater Element for every element in the array. The Next greater Element of element x is first greater element on its right side. […]

Introducing Graph Data Structure with Adjacency matrix implementation

Binary tree is a specialization of Graph data structure. Node in a Graph is called a Vertex and the connection between two vertices is called […]