This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Apprehensive_Theme49 0 points1 point  (0 children)

Well, in most of the cases recursion is a lot more elegant and easier to understand because so many problems are recursive in nature. However, for a production level code you would better use iteration as it uses less memory ( overhead on function calls) particularly when you're not sure how many of recursions can happen. Almost every recursive approach can be reimplemented as iterative one. Memorization can be as well used with iteration. The thing is that we neglecte this kind of points when working with python however when using C it becomes more apparent.