On Nov 16, 4:15 pm, "Meryl Silverburgh" <[EMAIL PROTECTED]> wrote: > This is the full source code: > def A(w, v, i,j): > if i == 0 or j == 0: return 0 > if w[i-1] > j: return A(w, v, i-1, j) > if w[i-1] <= j: return max(A(w,v, i-1, j), v[i-1] + A(w,v, i-1, j - > w[i-1]))
Huh??? There is only a very slight resemblance to the code that you posted previously ... both contain 'max, 'i', and 'j' > I am reading this blog > > http://20bits.com/articles/introduction-to-dynamic-programming/ I suggest that you don't bother reading a blog written by somebody who (presumably consciously) keyed in that "if w[i-1] <= j: " above. Oh, very interesting, it contains: def msum(a): return max([(sum(a[j:i]), (j,i)) for i in range(1,len(a)+1) for j in range(i)]) Would you care to tell us which part of which function you are now trying to understand? -- http://mail.python.org/mailman/listinfo/python-list
