Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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: 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
Step: 1
Solutions Step 1 1 when x3 and y3 the output 27 2when x4 and y2n1t...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started