Homework Help Question & Answers

8. [10 points) Consider the following algorithm procedure Algorithm(: integer, n: positive integer; 81,...a s integers with vhilei<r print (l, r, mı, arn, 》 if z > am then 1:= m + 1 if za...


8. [10 points) Consider the following algorithm procedure Algorithm(: integer, n: positive integer; 81,...a s integers with v
8. [10 points) Consider the following algorithm procedure Algorithm(: integer, n: positive integer; 81,...a s integers with vhilei am then 1:= m + 1 if za then anstwer-1 return answer 18 and the (a) Assume that this algorithm receives as input the numbersz-32 and corresponding sequence of integers 2 | 3 1 1 4151617| 8| 9 | 10 İ 11 İ 12 | 13 | 14|15 | 16 | 17 | 18 (b) Assume that this algorithm receives as input the minbers z = 11 and n= 17 and the corresponding sequence of integers 12 314 5 617 819 10 11 | 12 13 |14 15 16 17 a, 0 34810 23 29 31 35 37 43 59 63 6758183 Fill out the tables below: Table for question 8b) Table for question 8a) em (c) Assume that the algorithm receives the same input values as in part a). Once the algorithm finishes, it returns as output the value of the variable answer. What is its value? answer_ (d) Assume that the algorithm receives the same input values as in part b). Once the algorithm finishes, it returns as output the value of the variable answer. What is its value? answer (e) Assume that this algorithm receives as input the integer z, the positive integer n, and the sequence fa1,a,asan) of distinct integers. Describe in words the meaning of the output answer with respect to the variables y, n and the sequence of at's.
0 0
Add a comment
Answer #1

Please find the answers below:

Question 8 a):

1 18 9 19 32
10 18 14 49 32
10 14 12 30 32
13 14 13 32 32

Question 8 b):

1 17 9 35 11
1 9 5 10 11
6 9 7 29 11
6 7 6 23 11

Question 8 c):

Answer = 13

Question 8 d):

Answer = 0

Please find below calculation for your reference.

8 A구 그 3511 1 189 32 32 7 l9 ア43 13 <14 13 24 13 32 34 67623 ,, イリ 2 a꺼뻐

Add a comment
Know the answer?
Add Answer to:
8. [10 points) Consider the following algorithm procedure Algorithm(: integer, n: positive integer; 81,...a s integers with vhilei<r print (l, r, mı, arn, 》 if z > am then 1:= m + 1 if za...
Your Answer:

Post as a guest

Your Name:
What's your source?

Earn Coin

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
Free Homework App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.