Question: Answer the following questions based on the algorithm given below. Algorithm 1: Mystery(x,y: Positive Integers) 1 result = 1 2 while y + 1

Answer the following questions based on the algorithm given below. Algorithm 1:

Answer the following questions based on the algorithm given below. Algorithm 1: Mystery(x,y: Positive Integers) 1 result = 1 2 while y + 1 do 3 if y is odd then result = 2x result 4 5 y=y-1 6 end 7 8 y=y/2 9 end 10 result result xx 11 return result 1.1 What is the output of the algorithm when the inputs are r = 3 and y = 3? 1.2 How many times will line 5 be executed if the inputs are y=2" +1, where n is a positive integer? 4 and 1.3 What does the algorithm do?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Solutions Step 1 1 when x3 and y3 the output 27 2when x4 and y2n1t... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!