To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 5002
5001  |  5003
Subject: 
Re: recursion (was RE: Would-be hacker queries.)
Newsgroups: 
lugnet.robotics
Date: 
Tue, 11 May 1999 22:08:27 GMT
Original-From: 
John A. Tamplin <jat@liveonthenet.%StopSpammers%com>
Viewed: 
913 times
  
On Tue, 11 May 1999, Paul Speed wrote:

Important clarification: "data stack" free recursion.  This is
an important significance.  It's really only useful for systems with
no data stack.... or alternately as an interesting conversation piece.

Actually, he goes on to show that in some cases you can eliminate call
stack recursion using simple transforms as well.

What's usually more clever is using data recursion instead
of code recursion, or figuring out that your algorithm isn't recursive
in the first place despite how cool it looked. :)

For example, JVM does this by keeping a frame stack of methods that have
been executed.  The interpreter main loop happily switches from one method
to another by pushing and popping frames, all without recursively
invoking the interpreter (you can get recursion when you call a native
method which then calls a non-native method, but that doesn't happen often).

Any recursive algorithm can always be recoded as an iterative one.  The
iterative one is usually faster and always takes less space (the recursive
algorithm must always store the return address in addition to the data
needed for each step), but the recursive algorithm almost always looks
more elegant :).

John A. Tamplin Traveller Information Services
jat@LiveOnTheNet.COM 2104 West Ferry Way
256/705-7007 - FAX 256/705-7100 Huntsville, AL 35801

--
Did you check the web site first?: http://www.crynwr.com/lego-robotics



Message has 1 Reply:
  Re: recursion (was RE: Would-be hacker queries.)
 
John A. Tamplin skrev i meddelandet ... (...) Are you sure? I have faint memories from University of a function called 'The Ackermann Function' which was 'recursive in all directions', and couldn't be expressed iteratively. Of course, my memory is (...) (25 years ago, 12-May-99, to lugnet.robotics)

Message is in Reply To:
  Re: recursion (was RE: Would-be hacker queries.)
 
Hi, Important clarification: "data stack" free recursion. This is an important significance. It's really only useful for systems with no data stack.... or alternately as an interesting conversation piece. What's usually more clever is using data (...) (25 years ago, 11-May-99, to lugnet.robotics)

21 Messages in This Thread:






Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR