When to use recursion?

What are the rules of recursion?

  • Base cases: You must always have some base or trivial case,which can be solved without recursion.
  • Making progress: For the cases that are to be solved recursively,the recursive call must always be to a case that makes progress toward the base case.
  • Design rule: Assume that all the recursive calls work. ...

What is the difference between iteration and recursion?

  • The primary difference between recursion and iteration is that is a recursion is a process, always applied to a function. The iteration is applied to the set of instructions which we want to get repeatedly executed.

What is an example of recursion?

  • An example of something recursive is a computer program that uses the same formula at the end of one line of numbers to create the next line of numbers. An example of something recursive is an essay that keeps repeating the same ideas over and over again. YourDictionary definition and usage example. "recursive.".

image-When to use recursion?
image-When to use recursion?
Share this Post: