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

write the translator of third generation language​
What is the value of x in the triangle?
What form of decomposition do decomposers perform? A. mechanical B. chemical C. autotroph
An arrow is shot vertically upward at a rate of 210 feet per second. Use the projectile formula h = −16t2 + v0t to determine at what time t (in seconds) the hei
1. What did the events of the Whiskey Rebellion reveal about the government created by the U.S. Constitution? a. The government had the power to enforce laws. b
help helllllllllp asappp
The heavy taxes made the people feel their king was a what?
What state has a northern border called the twelve-mile circle?.
What does it mean if a parent doesn’t care about you?
After reading the speech by Emma Watson, compose a response of at least 200 words in which you identify her main argument, explain her main points, and analyze