221k views
3 votes
What problem can occur when a programmer fails to specify the base case or to reduce the size of the problem in a way that terminates the recursive process?

1 Answer

4 votes

Answer:

Inifinite loop will occur.

Step-by-step explanation:

For instance the code block below will result in an infinite loop:

int prev (x){

Return prev (x-1);

}

The base case is what determine when the function should stop calling itself; if it is absent, infinite loop will occur.

In the above code, a base case of when x = 0 or x = 1 should have been added to avoid the infinite loop.

User Dominic Cotton
by
6.9k points