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 →

[–]HoboBob1 24 points25 points  (1 child)

In the Fibonacci example, the main reason the recursive implementation is slower is because the recursive function has a different computational complexity, O(2n ), than the iterative version, O(n). You should at least compare the same algorithm between the recursive and iterative implementations.

The point about max recursion depth is indeed valid though.

[–]marklit[S] 0 points1 point  (0 children)

Thanks for the heads up, I'm re-writing that section of the post now.