Q. What are the base case and recursive case? What is their role in a recursive program?
Answer =
In a recursive solution, the base cases are predetermined solutions for the simplest version of the problem:
if the given problem is a base case, no further computation is necessary to get the result.
The recursive case is the one that calls the function again with a new set of values. The recursive step is a set of rules that eventually reduces all versions of the problem to one of the base cases when applied repeatedly.
if the given problem is a base case, no further computation is necessary to get the result.
The recursive case is the one that calls the function again with a new set of values. The recursive step is a set of rules that eventually reduces all versions of the problem to one of the base cases when applied repeatedly.
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )