although the use of recursive algorithm is programmatically readable, it has many problems:
- as the computing scale increases, it may cause the call stack to overflow
- each function call has time and space overhead. The performance is not very good
- is not easy to test, the code is correct when the scale is small, and it is not guaranteed to be correct when the scale is large.
question: should we try to avoid using recursion when writing code and use equivalent loops instead?
Thank you!