Re: [algogeeks] Re: Dynamic programming question

2011-12-22 Thread Azhar Hussain
The first problem I mentioned is a similar problem. but the second one seems to be little difficult. where additional path we could go is up. - Azhar. On Thu, Dec 15, 2011 at 10:17 PM, Dheeraj Jain dheerajj...@gmail.comwrote: http://www.geeksforgeeks.org/archives/14943 is a very similar

Re: [algogeeks] Re: Dynamic programming question

2011-12-15 Thread Dheeraj Jain
http://www.geeksforgeeks.org/archives/14943 is a very similar problem. On Thu, Dec 15, 2011 at 1:12 PM, WgpShashank shashank7andr...@gmail.comwrote: @Azhar , also for 1st question u r trying Array DS will suffices. Its Standard Coin Change Problem , u need to solve subproblem 1st , store it in

[algogeeks] Re: Dynamic programming question

2011-12-14 Thread Gene
Longest path won't work so well because it will return infinity if a path contains a positive cycle, which doesn't apply here because once you pick up an apple, it's gone. On Dec 13, 7:17 am, vikas vikas.rastogi2...@gmail.com wrote: Graph take up, right  and bottom as nodes connected to current

Re: [algogeeks] Re: Dynamic programming question

2011-12-14 Thread Azhar Hussain
We need not necessarily pick the apple. We need to suggest a way that could have maximum apples and path need not be longest. Another person will follow our path and pick the apples. we can start from specified (i,j) and have to reach specified (i, n) traversing either top, right, down(not left).

[algogeeks] Re: Dynamic programming question

2011-12-14 Thread Tryzen
From (a,b) to (c,n) = What about traversing all columns n = j = a as we can move up-down-right anytime we want. On Dec 14, 5:57 pm, Azhar Hussain azhar...@gmail.com wrote: We need not necessarily pick the apple. We need to suggest a way that could have maximum apples and path need not be

[algogeeks] Re: Dynamic programming question

2011-12-14 Thread WgpShashank
@Azhar , 1st Try to formulate the recursive relation , then draw recursive tree , then u willl know why it need DP to solve efficiently , then u can memozation to solve the same . Hope it help. Thanks Shashank Mani CSE ,BIT Mesra http://shashank7s.blogspot.com/ -- You received this

[algogeeks] Re: Dynamic programming question

2011-12-14 Thread WgpShashank
@Azhar , also for 1st question u r trying Array DS will suffices. Its Standard Coin Change Problem , u need to solve subproblem 1st , store it in extra array to avoid recalculation , if u are able to produce the sum less given sum then u can use same approach to reach desired sum . it uses the

[algogeeks] Re: Dynamic programming question

2011-12-13 Thread vikas
Graph take up, right and bottom as nodes connected to current and do find max path. On Dec 13, 3:44 pm, Azhar Hussain azhar...@gmail.com wrote:   We have apples arranged in a mxn matrix. We start from the upper left corner and have to reach bottom right corner with maximum apples. We can only