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 / 5011 (+5)
  RE: cursion (was RE: Would-be hacker queries.)
 
I hate to be pedantic, but what you're describing is functional composition. The key to recursion is that the function calls itself. e.g. int factorial(int n) // assumes n > 0 { if (n > 1) return n * factorial( n - 1); // the recursive call, this is (...) (28 years ago, 11-May-99, to lugnet.robotics)
 
  A recursion question/test...
 
Hi, With all the discussion on understanding recursion and such for programmers I thought I'd share a little problem I find enlightening.... Describe as simple a recursive algorithm as possible for summing the first n numbers. ___...___ Three step (...) (28 years ago, 12-May-99, to lugnet.robotics)
 
  Re: A recursion question/test...
 
(...) d'oh. my ($n)=@ARGV; my $result=$n; $result += $n while($n--); print $result."\n"; What a difference a compile makes... but it's still not very recursive. I'll be interested in seeing your answer. Aloha, JR - - - - - - - - - - JR Conlin (...) (28 years ago, 12-May-99, to lugnet.robotics)
 
  Re: A recursion question/test...
 
Jim Choate poses the problem: (...) What other than sum(n) = n + sum(n-1) (with proper termination conditions, of course - sum(1) = 1). Ralph deal@kzoo.edu -- Did you check the web site first?: (URL) (28 years ago, 12-May-99, to lugnet.robotics)
 
  You know, all this computer science talk doesn't really belong here.
 
Try lugnet.off-topic.geek. :) (...) (28 years ago, 12-May-99, to lugnet.robotics)

Next Page:  5 more | 10 more | 20 more
Redisplay Messages:  All | Compact

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