Recursion is one of the algorithm techniques to solve the problem in Computer programming.

A recursive function is a function that calls itself until some condition is satisfied

Some problems solved with the recursive technique

  • Factorial Calculation using Recursive function
  • Sum of natural numbers
  • Depth-first Search algorithm in binary Tree

Iteration is the opposite of the Recursive technique

Difference Between Iteration and Recursive Techniques

Iterative and Recursive are functions to solve a technical problem

Recursive FunctionIterative Function
Here, Function is called repeatedly until some condition is satisfied, returns the resultCode is executed in for loop and return result
Function exits when some condition is satisfiedFor loop uses initialization, conditional express, and change of its value
It is slower than Iterative functionIt is faster than recursive function
More MemoryLess memory
Less CodeMore coding