Left view of a binary tree

Write code to print the left-view of a binary tree. Left-view of the tree is the nodes visible when the tree is seen from the […]

Sort in C++ standard template library

Two elements of complex data types are not directly comparable. Consider the student structure defined as below struct Student { int rollNo; char name[25]; char […]

Feedback for Engineering colleges

I visit many colleges and universities (mostly technical). Following is my feedback:

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 […]