Answered step by step
Verified Expert Solution
Link Copied!

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Precalculus

Authors: Jay Abramson

1st Edition

1938168348, 978-1938168345

More Books

Students also viewed these Programming questions

Question

Is there administrative support?

Answered: 1 week ago