GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

Rules of recursion.

What is the rules of recursion?

asked Dec 17, 2016 by rashedcs

2 Answers

 
Best answer
  • a recursive method must have at least one base case (that does not make a recursive call)
  • a recursive method must have at least one recursive case (that does make a recursive call)
  • to avoid "infinite" recursion, a recursive call must always be made with a smaller or simpler subproblem of the original problem being solved
answered Dec 19, 2016 by rahul31313
selected Jan 16, 2017 by rashedcs

There should be base case or say some terminating condition for recursion.

answered Dec 19, 2016 by shivdutt
...