Discussion: example program
Afficher un message
Vieux 02/06/2008, 12h44   #2
Bartc
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: example program

aarklon@gmail.com wrote:
> Hi all,
>
> can any one give a example program where recursive version is faster
> than iterative version ?


For trivial programs there may or may not be examples where recursion is
faster.

But recursion is a natural fit for many kinds of programming which would be
a pain to implement with iterative methods.

Especially with making arrangements to save/restore complex data which may
well end up slower than just using recursion. But even if recursion was
slower, the difference would be minimal in a real application, while keeping
the code much cleaner.

--
Bartc


  Réponse avec citation
 
Page generated in 0,05712 seconds with 9 queries