Trade-off between recursion and iteration
Trade-off between recursion and iteration
Conclusion:
The recursive function is easy to write, but they do not perform well as compared to
iteration whereas, the iteration is hard to write but their performance is good as
compared to recursion.
Example:
Let us understand recursion with a function which will return the factorial of the
number.