bibian7074 bibian7074
  • 24-01-2020
  • Computers and Technology
contestada

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?

Respuesta :

ibnahmadbello
ibnahmadbello ibnahmadbello
  • 25-01-2020

Answer:

Inifinite loop will occur.

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.

Answer Link

Otras preguntas

How does early voting allow increased voter participation?
Find the length of the rectangle, if the perimeter is 74 units.
3. What is the importance of an amin?​
why do we need patch panel and modular box?​
If Maria designs a function to predict the amount of revenue, r, generated as a function of the number of people, n, who attend a fundraiser, explain why 13.5 w
Maya’s watch shows a time of 1:30pm. At. 5:30pm, her watch shows the time as 5:42pm. How many minutes did her watch gain every hour after 1:30pm?
In the Missouri Compromise, describe the dividing line.
best anime opening/ending n your opinion? mine would be unravel or mahou​
Why did American scientists start to develop a superbomb in 1942?
Read the sentences below. The new safety requirements were enacted based on scientists’ recommendations. Fewer accidents occurred. Which combines the sentences