# Category Archives: Dynamic Programming

## Dynamic Programming | Set 17 (Palindrome Partitioning)June 17, 2012

Given a string, a partitioning of the string is a palindrome partitioning if every substring of the partition is a palindrome.

## Dynamic Programming | Set 16 (Floyd Warshall Algorithm)June 7, 2012

The Floyd Warshall Algorithm is for solving the All Pairs Shortest Path problem. The problem is to find shortest distances between every pair of vertices in a given edge weighted directed Graph.

## Dynamic Programming | Set 15 (Longest Bitonic Subsequence)June 6, 2012

Given an array arr[0 … n-1] containing n positive integers, a subsequence of arr[] is called Bitonic if it is first increasing, then decreasing. Write a function that takes an array as argument and returns the length of the longest bitonic subsequence.

## Dynamic Programming | Set 14 (Maximum Sum Increasing Subsequence)May 15, 2012

Given an array of n positive integers. Write a program to find the sum of maximum sum subsequence of the given array such that the intgers in the subsequence are sorted in increasing order.

## Dynamic Programming | Set 13 (Cutting a Rod)May 11, 2012

Given a rod of length n inches and an array of prices that contains prices of all pieces of size smaller than n.

## Dynamic Programming | Set 12 (Longest Palindromic Subsequence)May 8, 2012

Given a sequence, find the length of the longest palindromic subsequence in it. For example, if the given sequence is “BBABCBCAB”, then the output should be 7 as “BABCBAB” is the longest palindromic subseuqnce in it.

## Dynamic Programming | Set 11 (Egg Dropping Puzzle)April 17, 2012

The following is a description of the instance of this famous puzzle involving n=2 eggs and a building with k=36 floors.

## Dynamic Programming | Set 10 ( 0-1 Knapsack Problem)March 19, 2012

Given weights and values of n items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack.

## Dynamic Programming | Set 9 (Binomial Coefficient)February 11, 2012

Following are common definition of Binomial Coefficients. 1) A binomial coefficient C(n, k) can be defined as the coefficient of X^k in the expansion of (1 + X)^n.

## Dynamic Programming | Set 8 (Matrix Chain Multiplication)February 2, 2012

Given a sequence of matrices, find the most efficient way to multiply these matrices together.

## Dynamic Programming | Set 7 (Coin Change)January 29, 2012

Given a value N, if we want to make change for N cents, and we have infinite supply of each of S = { S1, S2, .. , Sm} valued coins, how many ways can we make the change? The order of coins doesn’t matter.