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 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 move either down or right. > > Now if we can start any where in the matrix and have to reach anywhere on > > the right(reach n column). We can either up, down, right(but not left). We > > have to collect maximum apples from a given location. > > I am trying to solve problem. solution for the first one is given > > athttp://community.topcoder.com/tc?module=Static&d1=tutorials&d2=dynProg. > > What data structure would be suitable for the second problem and will > > dynamic programming work. > > > Thanks in advance. > > Azhar. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@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.