Article View: de.comp.lang.c++
Article #803Re: Recursion vs Iteration
From: Baltasar Trancon-y-Widemann
Date: Wed, 15 Nov 1995 21:44
Date: Wed, 15 Nov 1995 21:44
34 lines
1866 bytes
1866 bytes
Joost Romeu (joost@sirius.com) wrote: : I don't understand recursion but I have a feeling about it. I'd appreciate : it if you could share your understandings about recursion and iteration : with me. : On the face of it: : - There's something very attractive about recursion. It seems a "smart" : and interesting (albeit tricky and magical) way of defining, approaching, : and solving a problem. : - Iteration, on the other hand, seems a ploughhorse way of trudging : through a problem - easy to grasp and lay down; then lots of plowing... right. Recursion is what a good computer scientist types in, iteration is what a good compiler makes of it... The second aspect is that these two concepts belong to different viewpoints of a problem: recursion is a functional approach, telling the machine that the solution of a problem depends on the solution of a very similar, hopefully simpler problem. Iteration, on the other hand, is an imperative approach, telling the machine to go ahead and solve a part of the problem then step back and apply the same methods to the next part until the problem is done. If you don't want to worry about the philosophical consequences of your bubble-sort-algorithm or who knows what -- just rely on bits of code other people wrote, and pretend to be impartial. -- -- trancon@cs.tu-berlin.de
Technical Details
Message-ID:
<48dmv6$hqu@news.cs.tu-berlin.de>Path:
arc1-ca.pugleaf.net!cs.tu-berlin.de!tranconReferences:
<joost-2010951205310001@slip74.sirius.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!cs.tu-berlin.de!trancon From: trancon@cs.tu-berlin.de (Baltasar Trancon-y-Widemann) Newsgroups: de.comp.lang.c++ Subject: Re: Recursion vs Iteration Date: 15 Nov 1995 21:44:06 GMT Organization: Technical University of Berlin, Germany Message-ID: <48dmv6$hqu@news.cs.tu-berlin.de> References: <joost-2010951205310001@slip74.sirius.com> NNTP-Posting-Host: hombre.cs.tu-berlin.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit