In Matrix Chain Multiplication problem we have to find an optimal solution to multiply given matrices. The problem is not multiply the matrices but to find the sequence of matrix … Continue Reading

## Check if a line Intersect or Touches a Circle

Check if a line Intersect or Touches a Circle

It is a very easy math problem, give an equation of a line, a radius of a circle and its center … Continue Reading

## Depth First Traversal – DFS – Graph

Depth first traversal is an algorithm for traversing tree or graph data structures. In DFS we start from a root node (can be any node in case of graph), and … Continue Reading

## Breadth First Search – BFS – Graph

Breadth first search is an algorithm for searching and traversing in a tree or graph data structures.

Below is the java implementation for Bread first Traversal.

#### Program

import java.util.*; public… Continue Reading

## Reverse words in a String

The problem is we have a string and we have to reverse each word in a string. We have to write a program for the same.

… Continue Reading

## Program to Print LEADERS in an Array

**LEADER** in an array is an element which is greater than all element to its right side. Below are the methods and their implementation is given to print LEADERS in … Continue Reading

## Length of longest consecutive 1s in Binary Representation

Given a decimal number, we have to print the length of longest consecutive 1s in binary representation.

for example, if we have 55 the binary representation will be 110111. So … Continue Reading

## Returned values of printf() and scanf()

Returned values of printf() and scanf()

In C, printf() is used to print, and scanf() is used to read data.

Value returned by **printf()** is the number of characters successfully … Continue Reading

## Program to print Boundary nodes of Binary Tree – Boundary Traversal of Binary Tree

In this post we are going to write a program which will print the boundary nodes of a binary tree. Also known as boundary traversal of binary tree.

Boundary nodes … Continue Reading

## Switch Between Activities in Android

Here in this post we are going to learn how to switch between activities in android. Means how to go from one activity to another.Below is very simple example. So … Continue Reading