Subject:
|
Re: A recursion question/test...
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Wed, 12 May 1999 04:48:10 GMT
|
Original-From:
|
JR Conlin <jrconlin@SPAMLESSemail.com>
|
Viewed:
|
588 times
|
| |
| |
> Iterative:
> my $result = $lowBoundry;
> while ($result++ <=$highBoundry);
> return $result;
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 jrconlin@email.com
Techno-Athiest yahooPage: jrconlin
<http://home.earthlink.net/~jrconlin>
--
Did you check the web site first?: http://www.crynwr.com/lego-robotics
|
|
Message is in Reply To:
| | 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 (...) (26 years ago, 12-May-99, to lugnet.robotics)
|
7 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|