@ankur: the operation for each cell in dp array is O(1) so since we fill n^2 cells the total complexity is O(n^2)
On Wed, Dec 15, 2010 at 10:12 AM, Ankur Khurana <ankur.kkhur...@gmail.com>wrote: > 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 > <amir.hossein.shahri...@gmail.com> 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 <sweetdivya....@gmail.com> 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 algoge...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > >> 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 algoge...@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > > 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 algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > 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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.