Re: Steve Summit C Notes {Anticipating the next one}
- From: "user923005" <dcorbit@xxxxxxxxx>
- Date: 19 Mar 2007 16:08:11 -0700
On Mar 18, 8:50 pm, Ben Pfaff <b...@xxxxxxxxxxxxxxx> wrote:
Richard Heathfield <r...@xxxxxxxxxxxxxxx> writes:
Old Wolf said:
There is a simpler way to compute the sequence of Fibonacci numbers !
usernnnnn's solution looked pretty simple to me. What way did you have
in mind that is simpler? If it involves recursion or iteration, you'll
have your work cut out justifying that "simpler" claim.
If you want the sequence, then recursion or iteration might
really be simpler.
If you just want one value at a specified place in the sequence,
then it's easier to use the closed form.
--
"In My Egotistical Opinion, most people's C programs should be indented six
feet downward and covered with dirt." -- Blair P. Houghton
In all of my replies, I tried to make the examples something that were
generally useful. That is why the solutions use function calls and
are not simply inlined main() routines (except the even/odd thing
which was totally trivial and not worth the bother).
In other words, it does not simply solve the problem at hand for a
given value, but solves the problem in a general sense. (AKA
'reusable').
That is the chief distraction I see from most of the other solutions.
They solve the exact given instance of the problem but not the general
case, so the only utility of the code presented is to solve the single
problem posed -- and not having usages for future problems of a
similar nature. I think that is a very bad way to code. I think it
even worse to teach it to a beginner. But you have to start
somewhere.
IMO-YMMV.
.
- References:
- Steve Summit C Notes {Anticipating the next one}
- From: user923005
- Re: Steve Summit C Notes {Anticipating the next one}
- From: Joe Wright
- Re: Steve Summit C Notes {Anticipating the next one}
- From: Keith Thompson
- Re: Steve Summit C Notes {Anticipating the next one}
- From: Old Wolf
- Re: Steve Summit C Notes {Anticipating the next one}
- From: Richard Heathfield
- Re: Steve Summit C Notes {Anticipating the next one}
- From: Ben Pfaff
- Steve Summit C Notes {Anticipating the next one}
- Prev by Date: Re: executing shell commands from c?
- Next by Date: Re: Infinite loop
- Previous by thread: Re: Steve Summit C Notes {Anticipating the next one}
- Next by thread: From vasanth
- Index(es):
Relevant Pages
|