Recursion is a widely used phenomenon in computer science used to solve complex problems by breaking them down into simpler ones. Recursion is a process by which a function calls itself directly or indirectly. The corresponding function is called as recursive function.
Using recursive algorithms, certain complex problems can be solved quite easily.
In a recursive function, the solution to the base case is provided and the solution of the bigger problem is expressed in terms of smaller problems.
The role of the base condition is to stop a recursive function from executing endlessly – once a pre-specified base condition is met, the function knows it’s time to exit.