Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2016-05-05 02:35 GMT
Find Nodes?
    Voting Booth?