![]() |
|
Factorial Series - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: C, C++, & Obj-C (https://sinister.li/Forum-C-C-Obj-C) +--- Thread: Factorial Series (/Thread-Factorial-Series) Pages:
1
2
|
RE: Factorial Series - brainfreeezed1 - 11-20-2012 Thank you very much for explaining.
RE: Factorial Series - Frooxius - 11-21-2012 You're welcome :-) Also I might add that from practical standpoint (something you would use for highest performance) the iterative (using a loop) version is even better and faster than any of the recursive variants. Generally recursive functions are slower and use way more memory than needed (there's large overhead because with each nested call a copy of all the variables within a function is created, plus a portion of the processing time is devoted to the setting up a call to the function as well as calling it and then cleaning up after it returns.) so if you're looking for a practical solution, use the iterative version. In many cases however, some things are much more difficult to express using iterative way than recursive, so the iterative version of algorithm might not be available. In this case however, designing a recursive variant is more of an academic/theoretical/learning thing, rather than a practical one. |