how do we find the complexity of DP program ? i know it cn be done using DP states , but the gien complexity is n^2 . i am not sure how to compare that....
On Tue, Dec 14, 2010 at 11:41 PM, Amir hossein Shahriari <[email protected]> wrote: > we can use DP to solve this: > dp[i][j] = coins[i][j] + max ( dp[i-1][j] , dp[i][j-1] ) > > On Tue, Dec 14, 2010 at 7:24 PM, divya <[email protected]> wrote: >> >> A table composed of N x M cells, each having a certain quantity of >> coins. You start from the upper-left corner. At each step you can go >> down or right one cell. Find the maximum number of coins you can >> collect. >> >> Provide an algorithm of O(n^2) solution................. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
