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

If lisa has 2,134 buttons that needed to be sorted equally into 12 jars.How many buttons will be in each jar.
HELP PLEASE!!!!!!!!!!!
A recipe calls for 40 ounces of meat.How many pounds of meat does the recipe require?
Determine the first four terms of the sequence in which the nth term is
Please help. I've spent so much time on this and I can't find most of the answers.
What is the weight of a 5.00 kg object on Earth? Assume g=9.81 m/s^2.
Can you help me on this?
What was not a concern of Charlemagne
What is the equation of a line with slope −23 and a y-intercept of −4 ? A. y=−23x−4 B. y=23x+4 C. y=−4x−23 D. y=4x−23
Can you help me with this problem?