[algogeeks] Re: Dynamic Programming Problem SPOJ-AMR11A

2012-07-18 Thread Bharat Kul Ratan
If you need hint: I used DP (Dynamic Programming) to solve this and get AC (Accepted). I stored the matrix as 2-D array and then started with array[R][C]. From there I can go upward and left. In each element of array put the minimum possible value to get the array[R][C]. In case, if we get the

[algogeeks] Re: Dynamic programming problem

2011-12-16 Thread Lucifer
Take an array of size Min[N+1][S+1] where, N is the total no. of unique denominations and S is the total sum Let the value array be V[N]; // let it be 1- based indexed for ease of explanation in the below given code snippet. Initialize the following: a) for (i =0; i = N; ++i) Min[i][0]

[algogeeks] Re: Dynamic Programming Problem

2011-07-09 Thread Konstantin
Use complete search, add memoization and you have a top-down dynamic programming solution ready. - lets say we have division positions in an array cuts[] - start and end will identify the position of current cut (taken from cuts[] array) - initialize memo[][] array to INT_MAX, this is the place

[algogeeks] Re: Dynamic Programming Problem on Strings

2010-08-13 Thread vikas kumar
what about printing these strings onto terminal. can printing of the string is also similar. I tried to develop the algo but got messed up.can some one help? On Aug 8, 2:53 am, Amir hossein Shahriari amir.hossein.shahri...@gmail.com wrote: @ankur: dp[i][j] number of (prefix) strings that have i