subject
Computers and Technology, 17.04.2020 22:55 56340

Given positive integers a and b, we want to compute some integers s and t such that gcd(a, b) = sa + tb.

Consider the following iterative program LIN_COMB(a, b) which is supposed to accomplish this:

Initialize variables c = a, d = b, s0 = 1, t0 = 0, s1 = 0, t1 = 1

While c 6= d, do the following:

If c < d, then decrement d by c, decrement s1 by s0, decrement t1 by t0

Else if c > d, then decrement c by d, decrement s0 by s1, decrement t0 by t1

Return s0 and t0.

a) Prove that (c = s0a + t0b) ∧ (d = s1a + t1b) is a loop invariant for the while loop in LIN_COMB.

b) Assume, in addition to (a), that gcd(a, b) = gcd(c, d) is a loop invariant for the while loop in LIN_COMB. Prove that LIN_COMB satisfies partial correctness.

c) Prove that (c > 0) ∧ (d > 0) is a loop invariant for the while loop in LIN_COMB.

d) Use the well-ordering principle and (c) to prove that LIN_COMB satisfies termination.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 17:30
What are the most commonly found items in the trash according to the municipal solid waste report?
Answers: 1
question
Computers and Technology, 24.06.2019 18:30
How does the use of e-mail benefit business communications? it can be sent at any time. it is faster than regular mail. it improves writing skills. it is less expensive than using a courier. it reduces the need for proofreading.
Answers: 1
question
Computers and Technology, 25.06.2019 00:00
One difference of input method between most desktop computers and most tablets is the memory the touch screen the speech recognition
Answers: 1
question
Computers and Technology, 25.06.2019 08:20
The process of representing data in digital form so it can be used by a digital computer is called decimal byterepresentation. - true or false
Answers: 3
You know the right answer?
Given positive integers a and b, we want to compute some integers s and t such that gcd(a, b) = sa +...
Questions
question
History, 19.10.2019 12:20
question
Mathematics, 19.10.2019 12:20
question
Biology, 19.10.2019 12:20
question
History, 19.10.2019 12:20
Questions on the website: 13722361