@Piyush:.. nope is not correct ... this is right....
0 1 2 3 0 1 0 0 0 1 1 0 1 0 2 1 0 1 0 3 1 0 1 0 4 1 0 1 0 use this code to precompute.. A[i,j] = A[i-1, j]; if ( A[i, j] == 0 and j - W[i] >=0) A[i, j] = A[i -1, j - W[i]]; On Tue, Jan 10, 2012 at 1:05 PM, Piyush Grover <piyush4u.iit...@gmail.com>wrote: > How to create the lookup table? > say if I have W = {2, 4, 6, 8} and Wmax = 3 > > 0 1 2 3 > 0 1 0 0 0 > 1 1 1 1 0 > > 2 1 1 1 1 > 3 1 1 1 1 > 4 1 1 1 1 > > Is this correct??? > > > On Mon, Jan 9, 2012 at 2:55 PM, Lucifer <sourabhd2...@gmail.com> wrote: > >> @All >> >> The same algo will work for both +ve and -ve nos.. no need for >> modification.. >> >> For ex- >> Say the sum is 4 and the set is { 1, 2, 3, -2 } >> >> Now if u include -2 as part of ur solution then for the rest 3 >> elements the sum would be 4-(-2) = 6, which is correct... >> >> >> On Jan 9, 2:20 pm, Siddhartha <thefourrup...@gmail.com> wrote: >> > yup...that was what i was thinking... i guess for negative nos, we can >> > define Wmax= sum of modulus of weights,and then the same algo works... >> >> -- >> 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. >> >> > -- > 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. > -- 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.