Question: 8. Iterative algorithm understanding (13 points) Mysteryly, z: positive integer) 1x=0 2 while z>0 3 if z mod 2 ==1 then 4 x= x+y y

8. Iterative algorithm understanding (13 points) Mysteryly, z: positive integer) 1x=0 2 while z>0 3 if z mod 2 ==1 then 4 x= x+y y = 2y 6 z = floor(2/2) //floor is the rounding down operation 7 return x Simulate this algorithm for y=4 and z=7 and answer the following questions: (3 points) At the end of the first execution of the while loop, x=_ v=__ and z= __ (3 points) At the end of the second execution of the while loop, x=_ Y_ and Z=- (3 points) At the end of the third execution of the while loop, x= y= and za (2 points) Value returned by the algorithm = (2 points) What does this algorithm compute
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
