Re: Factorial

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Wes Spikes (MornThdr_at_NOSPAMverizon.net)
Date: 05/21/04


Date: Fri, 21 May 2004 22:31:01 GMT

That reason is why I tried to further my knowledge by using Static arrays to
compute and only calc each value once, such that if it was alread calc once,
it just loads it!

-Wes

"Russ Holsclaw" <russ@holsclaw.nyet> wrote in message
news:u$aM3azPEHA.3944@tk2msftngp13.phx.gbl...
> > Here's some advice: even a double can't handle the factorial of
> 171.
> > Here's some more advice: recursion.
>
> And recursion is better because.....?
>
> I've never been able to figure out why computing factorials has
> always been the textbook example for recursion, when it can be
> handled more efficiently with a simple loop.
>
> Recursion is a good tool to use when processing things that are
> organized in a hierarchical or tree-like way. Otherwise, frankly,
> it's just an academic conceit... a form of masturbatory software
> design. Some people, particularly academics who have nothing
> better to do, use recursion because they think it makes them look
> cool. It's rarely if ever more efficient, is frequently
> dangerous, and isn't really as "elegant" as they'd like you to
> believe, either.
>
> I suppose the only reason why textbooks use factorial to
> illustrate recursion is that the resultant number always
> overflows before the call stack does, thus obscuring the reason
> why recursion should be avoided unless it's truly useful.
>



Relevant Pages

  • Re: Which PIC18 C Compiler?
    ... The root reason is re-entrant code makes RAM space indeterminate. ... Almost impossible and AFAIK more 8 bit compilers don't do recursion as standard. ... But the professional compilers don't. ...
    (comp.arch.embedded)
  • Re: RFC: enhancing the root mount logic
    ... This would make my writable boot cd a lot more elegant ... within reason. ... the depth of the recursion. ...
    (freebsd-arch)
  • Re: __lll_mutex_lock_wait ()
    ... The most likely reason is that the heap mutex that freeis trying ... functions from a signal handler. ... In order to understand recursion you must first understand recursion. ...
    (comp.os.linux.development.apps)
  • Re: Fixed point Lemma
    ... But would you give some reason for your ... recursive then it must be via a systematic numbering. ... recursion was to be proved equivalent to the numerical notion then some ... way of translating between symbols and numbers must be given, ...
    (sci.logic)
  • Re: __lll_mutex_lock_wait ()
    ... The most likely reason is that the heap mutex that freeis trying ... functions from a signal handler. ... In order to understand recursion you must first understand recursion. ...
    (comp.lang.cpp)