On 5/27/08, Roger Hui <[EMAIL PROTECTED]> wrote: > Raul's expression requires that 0 be the root. If not, > you need to relabel the tree so that 0 becomes > the root, find the path sums, and then permute the > sums at the end.
Or, expressed in J:
}.(+/@:{&(0,v)@~."1|:{&(0,p)^:a:i.1+#p)
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
