0
What is Base case
Why base case is necessary
6 odpowiedzi
+ 5
Hello there, the base case usually exists in an if statement where you don't return the function.
Here's an example in C#:
int Factorial(int number)
{
// base
if (number <= 1)
return 1;
return number * Factorial(--number);
}
Console.Write(Factorial(5));
// 120
The recursion doesn't end until the number reaches the base case.
+ 5
The base case exists to terminate the recursion. Without base case the recursion will continue infinitely.
+ 2
Now I am clear with this concept, thank you
+ 2
Base case is necessary because In The absence of base case ur loop will run infinite
0
Can you Tell base case in this problem
0
Vikalp Monas If you can detail more about the question.