Recursion is a process in which a solution (implemented in the form of a function) calls itself recursively to solve sub-parts of the same problem. Therefore, the function is calling itself recursively to arrive at the final solution. One point to be noted here is that one needs to provide a condition to terminate the recursion cycle. Using recursion results in a reduced length of the code since we are using the same code recursively. Algorithms like DFS of Graph, Towers of Hanoi (TOH), etc., use recursion for their implementation. The prime example of a recursion problem is the factorial of a number. During the calculation of the factorial of a number, we call the same function recursively with an input number lesser than the previous one so that eventually we multiply all the natural numbers lesser than the provided number. The program terminates when the number is equal to 1 or 0.