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 10:00
According to alisa miller foreign news bureaus
Answers: 3
question
Computers and Technology, 22.06.2019 11:00
The isometric projection camera technique provides an illusion of perspective by using things like parallax scrolling to create the illusion of 3d in a 2d game
Answers: 3
question
Computers and Technology, 22.06.2019 11:10
The total cost of textbooks for the term was collected from 36 students. create a histogram for this data. $140 $160 $160 $165 $180 $220 $235 $240 $250 $260 $280 $285 $285 $285 $290 $300 $300 $305 $310 $310 $315 $315 $320 $320 $330 $340 $345 $350 $355 $360 $360 $380 $395 $420 $460 $460
Answers: 2
question
Computers and Technology, 22.06.2019 22:40
Write a program that defines symbolic names for several string literals (chars between quotes). * use each symbolic name in a variable definition. * use of symbolic to compose the assembly code instruction set can perform vara = (vara - varb) + (varc - vard); ensure that variable is in unsigned integer data type. * you should also further enhance your symbolic logic block to to perform expression by introducing addition substitution rule. vara = (vara+varb) - (varc+vard). required: debug the disassembly code and note down the address and memory information.
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