3 ms·
Agree. I also note without surprise that there's no qualification as to why the recursive solution is "better". Indeed I think the author does a great job exp
by na85 12y ago
Agree. I also note without surprise that there's no qualification as to why the recursive solution is "better".
Indeed I think the author does a great job explaining why the recursive solution is usually worse, namely: harder to maintain, less intuitive, and only marginally faster.
- troels 12y agoAlso, depending on the language you work in, a function call may be quite expensive, compared to a straight loop.