Kizmit903 Kizmit903
  • 13-08-2020
  • Computers and Technology
contestada

Give a tight bound on the number of times the z = z + 1 statement is executed. i = 2 while ( i > 1 ) { i = floor(i/2) z = z + 1 }

Respuesta :

IfeanyiEze8899 IfeanyiEze8899
  • 17-08-2020

Answer:

zero ( 0) times.

Explanation:

In the code;

i = 2

while ( i > 2){

     i = floor( i/2 );

     z = z + 1;

}

the variable " i " is assigned the integer " 2 ", then the while statement loops with a condition of a greater " i " value and divides the value by two for every loop.

But in this case, the while statement is not executed as the value of " i " which is 2 is not greater than but equal to two.

Answer Link

Otras preguntas

Which event led directly to the secession of Southern states? a U.S. Army attack on Fort Sumter the election of Abraham Lincoln as president the implementat
topsoil contaminationspecies eradicationground water contaminationThree examples are provided. A serious environmental problem is the destruction ofA) farms. B)
Help me with english please
What actions has contributed the most to the rise in carbon dioxide levels from 1960 to 2011?
Based on the article which tissue do you think is affected by polio​
Which of the following is not a noncommercial food service operation? hotel dining room school dining hall hospital cafeteria ballpark hot dog vendor
Why did Simon finch leave England ?(To Kill A Mockingbird)
(1+2i)(2+I)+____=5(2+I)
Hey,can someone help me please
Which best describes the mood of "Check"? A. serious and frightened B. happy and cheerful C. confused and worried D. uplifting and inspiri