Data Structure and Algorithms

What is recursion?
Recursion is an algorithm technique where to complete a task one function calls itself with some part of the task. In recursive algorithm there is a base case on which recursive function stops its execution.

All recursive algorithms must satisfy the three rules

  • A recursive algorithm must have a base case.
  • A recursive algorithm must change its state and move toward the base case.
  • A recursive algorithm must call itself, recursively.

No comments:

Post a Comment