given a set of n number a_i sum up to M ,you use 2 dimensional table array m[0..M], m[i][b] indicate whether b can be hit using only {a_1,a_2,...,a_i},where each row only depends on the previous rows.
the inner j-loop check if the previous row m[i][j-arr[i]] can be hit then m[i+1][j] will be hit. Wladimir Araujo Tavares http://www.si.ufc.br/~wladimir <http://www.si.ufc.br/%7Ewladimir/> "Fiz uma faculdade! Só não fiz a segunda porque acabaram os tijolos." On Tue, Aug 31, 2010 at 10:13 AM, Chi Hoang <i...@chihoang.de> wrote: > Pairs of: > > ['1_2'] > ['1_3'] > ['1_4'] > ['1_5'] > ['1_6'] > ['1_7'] > ['2_3'] > ['2_4'] > ['2_5'] > ['2_6'] > ['2_7'] > ['3_4'] > ['3_5'] > ['3_6'] > ['3_7'] > ['4_5'] > ['4_6'] > ['4_7'] > ['5_6'] > ['5_7'] > ['6_7'] > > N^2-(N-1). > > > Am 31.08.2010 14:37, schrieb Maria: > > @Wladmir- Can u plz explain ur code??? > > > > > > -- > 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.