Re: need help with loops plz
Quote:
Originally Posted by
Nim
Inefficiency isn't elegant.
Quote:
el⋅e⋅gant
–adjective
1. tastefully fine or luxurious in dress, style, design, etc.: elegant furnishings.
2. gracefully refined and dignified, as in tastes, habits, or literary style: an elegant young gentleman; an elegant prosodist.
3. graceful in form or movement: an elegant wave of the hand.
4. appropriate to refined taste: a man devoted to elegant pursuits.
5. excellent; fine; superior: an absolutely elegant wine.
6. (of scientific, technical, or mathematical theories, solutions, etc.) gracefully concise and simple; admirably succinct.
I guess it is a matter of refined taste then :D
Quote:
Originally Posted by
Nim
Don't use recursion for the Fibonacci sequence. It's running time is exponential --(3/2)^N. Every CS book that has a chapter on algorithmic analysis tells you this.
I didn't say it was the most elegant, or the best approach to the problem. I merely stated that it is "about" as simple and elegant as you can get. See the difference? Personally I think that the recursive solution to a lot of problems is just plain sexy. Then again I actually enjoy writing code for fun in LISP, Scheme and ML :eek: