A recursive subroutine (or recursive method) is one that calls itself, either directly or indirectly.
When should we consider using recursive algorithms?
Cyclic process in which the number of variable values is not large then we should consider using the recursive algorithms. Recursion is often compared with iteration.
Advantages:
- A recursive algorithm is more readable in comparison with an iterative.
- Recursion can reduce time complexity.
- Since the code is short and adds clarity, it reduces the time needed to write and debug code.
- Recursion is better at tree traversal. (Dale, 2018, para.10)
Disadvantages:
- Multiple calls to a recursive function take longer.
- Recursion needs more memory. This is because it has to keep all the values in the memory till the end of the call.
- Recursion is slow if not implemented properly. (Dale, 2018m, para.12)
- It is less efficient than iteration since it involves creating many new variables.



