Number of ways to arrange tiles on a board

Given a board of size 2*n and tiles of dimension 1*2 each. In how many ways can we arrange the tiles so that entire board […]

Dynamic Programming concept

The basic idea of DP is applicable to problems that can be thought in terms of recursion. For example, consider problem of computing n’th fibonacci […]

Radix Sort

Consider an array that stores account numbers of all employees. One unique thing about account numbers is that they have equal number of digits. Let […]

Sum of all the nodes in a tree

Given a binary tree, where each node is having an integer value. Write a function that accept the root of this tree and returns the […]

Count number of zeros in a Row-wise Col-wise sorted binary matrix

Given a binary matrix with all rows and col sorted. Write code to count the number of zeros in that matrix. For example, if the […]

Iterative pre-order traversal using stack

We have seen the in-order traversal of a binary tree. It is a recursive code. Recursion stack can be simulated using an explicit Stack data […]

Right view of a binary tree

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

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: