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

What is the discontinuity of the function f(x)= x^2-4x-12/x+2
A toxic leader can destroy a group or company True or False?
Tadpoles must undergo a major metamorphosis to become frogs. This change includes reabsorption of the tail, growth of limbs, calcification of the skeleton, incr
How long is the segment from(-5,2)to(-5,-8)
which of the following sentences would be appropriate in a recipe A. Tu mets au four 1h B. Nous mettons au four 1h C. Mettre au four 1h D. Je mets au four 1h
Do you think Aristotle’s view of democracy is accurate? Why or why not?
A mountain range in western china from which several other ranges radiate
EPOs are usually developed and implemented by
What is electrostatic force?​
What is a hominid ?