Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 Do a trace of the values of the variable k in the following (somewhat

ID: 669152 • Letter: Q

Question

Question 1 Do a trace of the values of the variable k in the following (somewhat arbitrary) algorithm fragment.
k leftarrow 7
for j = 1 to 3
   k leftarrow k - j^2
   repeat while k < 10 j
    k leftarrow 2k
   endrepeat
endfor Question 2 Do a trace of the values of the variable k in the following (somewhat arbitrary) algorithm fragment.
k leftarrow 7
for j = 2 to 6
   k leftarrow k + j^2
   repeat while k > 5 j
    k leftarrow k-4
   endrepeat
endfor Question 3 S leftarrow 0; n leftarrow 1
repeat until S >= m
     S leftarrow S + n; n leftarrow n + 2
endrepeat
What value does the algorithm fragment above give to S when:
a) m=7 :
b) m=14 :
c) m=24 :
d) m=32 :
e) m=41 : Question 4 Suppose the Euclidean algorithm is used to determine . Using the notation of the course textbook (Maurer-Ralston, p. 84):

a) List the values of the variable , using commas to separate values.

b) List the values of the variable , using commas to separate values.

c)

Explanation / Answer

This question has multiple sub-parts. Please post 2 more questions. part 3 itself has 5 sub-parts

1)

k=7
1st iteration
k=6
k=12
2nd iteration
k=8
k=32
3rd iteration
k=32-9 = 23
k=46

2)

k=7
1st iteration
k=11
k=7
2nd iteration
k=7+9=16
k=11
3rd iteration
k=11+16=27
k=23
k=19
4th iteration
k=19+25=44
k=40
k=36
k=32
k=28
k=24
5th iteration
k=24+36=60
k=56
k=52
k=48
k=44
k=40
k=36
k=32
k=28

final value will be 28

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote