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, 22.06.2019 08:00
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
question
Computers and Technology, 22.06.2019 11:00
How does a policy manual an organization? a. it boost productivity. b. it create awareness in employees about the organization’s values. c. it employees achieve targets. d. it safeguards the organization from liabilities.
Answers: 1
question
Computers and Technology, 22.06.2019 11:00
When working with a team you should always do the following, except? question 3 options: be dependable and trustworthy be sensitive to others feelings do your fair share critique members of the group
Answers: 2
question
Computers and Technology, 23.06.2019 02:30
Three out of five seniors remain undecided about a college major at the end of their senior year.
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
English, 18.12.2019 09:31
question
Chemistry, 18.12.2019 09:31
question
Business, 18.12.2019 09:31
Questions on the website: 13722362