3 ms·
In implementation, yes, you'd (probably) use the closed form. Wouldn't make for much discussion of various fine points of recursion, though. The purpose of the
by wwweston 12y ago
In implementation, yes, you'd (probably) use the closed form. Wouldn't make for much discussion of various fine points of recursion, though. The purpose of these examples isn't to discuss efficient mathematical computation, it's to examine recursion.
For pedagogy Fibonacci and Factorial are used so often because they're easily defined, often already understood by most with high school algebra under their belt, and pretty much the archetypical recurrence relations. Not a bad place to start exploring recursion.
If you want people to move on, you're probably going to need to provide a better starting place for pedagogical purposes.
- PaulHoule 12y agoJust a different one. There are a lot of reasons why different programming communities don't listen to each other, and I find the fibonacci example to be a "bad smell".