# Category Archives: Algorithms

## Print all permutations with repetition of characters

Given a string of length n, print all permutation of the given string. Repetition of characters is allowed. Print these permutations in lexicographically sorted order… Read More »

## Matrix Chain Multiplication | DP-8

Given a sequence of matrices, find the most efficient way to multiply these matrices together. The problem is not actually to perform the multiplications, but… Read More »

## Coin Change | DP-7

Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1,… Read More »

## Minimum number of jumps to reach end

Given an array of integers where each element represents the max number of steps that can be made forward from that element. Write a function… Read More »

## Average of a stream of numbers

Difficulty Level: Rookie Given a stream of numbers, print average (or mean) of the stream at every point. For example, let us consider the stream… Read More »

## Find the maximum element in an array which is first increasing and then decreasing

Given an array of integers which is initially increasing and then decreasing, find the maximum value in the array. Examples : Input: arr[] = {8,… Read More »

## Print all sequences of given length

Given two integers k and n, write a function that prints all the sequences of length k composed of numbers 1,2..n. You need to print… Read More »

## Analysis of Algorithms | Set 1 (Asymptotic Analysis)

Why performance analysis? There are many important things that should be taken care of, like user friendliness, modularity, security, maintainability, etc. Why to worry about… Read More »

## Find a Fixed Point (Value equal to index) in a given array

Given an array of n distinct integers sorted in ascending order, write a function that returns a Fixed Point in the array, if there is… Read More »

## Practice Questions for Recursion | Set 7

Question 1 Predict the output of the following program. What does the following fun() do in general? C++ filter_none edit close play_arrow link brightness_4 code… Read More »

## Smallest of three integers without comparison operators

Write a program to find the smallest of three integers, without using any of the comparison operators. Let 3 input numbers be x, y and… Read More »

## C Program for Min Cost Path

Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m,… Read More »

## Java Program for Min Cost Path

Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m,… Read More »

## Python Program for Min Cost Path

Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m,… Read More »

## Min Cost Path | DP-6

Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m,… Read More »