[Jprogramming] tree sum and difference
Roger Hui
rhui000 at shaw.ca
Thu Mar 13 23:00:30 HKT 2008
What was the solution you anticipated?
----- Original Message -----
From: Raul Miller <rauldmiller at gmail.com>
Date: Thursday, March 13, 2008 5:55
Subject: Re: [Jprogramming] tree sum and difference
To: Programming forum <programming at jsoftware.com>
> Roger Hui wrote:
> tsum3=: 4 : 0
> d=. ((</.i.@#) y) -.&.> i=. ~.y
> while. 1 do.
> c=. #&>d
> j=. (*c)#i
> i=. c#i
> e=. ;d
> t=. i +//. e{x
> if. 0 *./@:= t do. x return. end.
> x=. (t+j{x) j}x
> d=. i <@;/. (j i. e){d,a:
> i=. j
> end.
> )
>
> That is significantly faster than I anticipated.
>
> (and, considerably more complicated than tdiff,
> but that complication is intrinsicly a part of this
> problem.).
More information about the Programming
mailing list