Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Behold! The power of recursion.

by pg (Canon)
on Oct 18, 2004 at 03:16 UTC ( #400044=note: print w/ replies, xml ) Need Help??


in reply to Re: Behold! The power of recursion.
in thread Behold! The power of recursion.

"It is worth noting that while an iterative solution will almost inevitably run faster than a recursive solution, a good recursive solution is often quite terse."

Fully agree. Although this demos recursion, it is not a good example to demo the NEED of recursion.

A typical situation where recursion becomes a clearer solution is that, you need complex stack data structure to remember things otherwise, which is not the case here.

"A classic very simple example is the calculation of factorial n!"

My favorite is Hanoi Tower problem.


Comment on Re^2: Behold! The power of recursion.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://400044]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2014-09-02 08:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (20 votes), past polls