+ 2
Recursive functions
When are recursive functions better than just loops? Because most of the examples is making a recursive function that counts a number's factorial, but using a loop is faster, and in my opinion better readable.
2 Answers
+ 10
Yes you are right loop is faster and readable.
But in dynamic programming recursion is very useful.
For instance Sometimes there is a question that is solved by splitting into small pieces and in this area recursion is very useful becz recurion recognize previous value.
And helping to solve a complex problem.