Why we need recursion?
Any problem can be solved by a recursive method as well as by the iterative method. But whenever we have a problem that is complex to do just by iterative/looping method. Then we are going to divide the problem into a smaller instance of the same problem that means we solve it by the recursive method.
What is call Stack?
A call stack is a stack data structure that is used to trace the sequence of the function call. When a function called then it’s get pushed inside the stack and when a function returns it popped out from the stack.
Three Concepts of Recursion
Base Case (Terminating Case)
Types of Recursion:
If a recursive function is calling itself and that recursive call is the last statement in the function. After that call there is nothing, it is not performing anything.
If a recursive function is calling itself and that recursive call is the first statement in the function and some operations are performed after the call. The function doesn’t have a processor to perform any operation at the time of calling. It has to do everything at the time of returning.
A linear recursive function is a function that only makes a single call to itself each time the function runs. It has something to process before and after the call.
Read Full Article Here – https://brain-mentors.com/what-is-recursion/