+ 1
What is base case?
9 Antworten
+ 8
The base case is a piece of code that allows us to end a recursive function.
void func(int x)
{
if (x == 0)
return...
else
{
cout << x
func(--x)
}
The base case here is the if (x == 0), as that is the function which will eventually allow us to exit a recursive function. Without a base case, the function will infinitely loop and not end.
+ 3
means its a condition to end the process
+ 2
Please elaborate on your question. Post some code, or explain what your question is.
+ 2
whay do you mean by the word base case
+ 2
best case is a exit condition for recursion
+ 1
Subha good question.important.
+ 1
Base case is like the last iteration of the recursive function. The end or final "go round".
0
xx.
- 1
ok i will try to elaborate give me some time