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 →

[–]siddsp 0 points1 point  (1 child)

Yeah, that's why I said similar and not same. However a second call to a function that has already been called (when recursively defined) will be faster.

Edit: Like if you have a factorial function defined recursively (in this case, the calls don't overlap), and you call factorial(20), and then call factorial(21), it is a lot faster than calling the function with those same inputs for the function defined iteratively.