_brian_d_foy <[EMAIL PROTECTED]> writes:

> In article <20011121131114.A19638@blackrider>, [EMAIL PROTECTED] 
> (Michael G Schwern) wrote:
> 
> > On Wed, Nov 21, 2001 at 09:51:32AM +0200, Ariel Scolnicov wrote:
> > > > 
>139423224561697698330489613862193018947914545343780323868775030943672596190605867771863846635039486902272
> > >
> > > For mission-critical enterprise-level high-throughput Fibonacci
> > > generation, you want to logarithmic-time algorithm.
> > >
> > > <hal2 92 [9:50] ~/Tests >/usr/bin/time ./fib-fast 500
> > > 
>139423224561697873388268830107091057642465893024716039229340111610069135233925734164006795046787674537984
> > >
> > > Algorithms count!
> 
> indeed, that's why there is a better one. :)
> 
>     http://www.ddj.com/documents/s=1498/ddj0104pl/
> 
> or
> 
>     http://search.cpan.org/doc/MJD/Memoize-0.66/Memoize.pm

Memoization translates the exponential-time (in n) algorithm to the
linear-time algorithm.  It cannot translate the linear-time algorithm
to a logarithmic-time algorithm.

> > So does correctness, yours gives the wrong answer.
> 
> that's nice, but not always an enterprise requirement in my 
> experience ;)

Seriously now, Memoize is one of those modules that *do* have great
advantages: when it's suitable, it's a drop-in improvement to your
code.

-- 
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            | [EMAIL PROTECTED]
Compugen Ltd.          |   +++ THIS SPACE TO LET +++    \ We recycle all our Hz
72 Pinhas Rosen St.    |Tel: +972-3-7658117 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555    http://3w.compugen.co.il/~ariels

Reply via email to