subject
Engineering, 28.01.2020 04:31 kailahgranger

The greatest common divisor (gcd) of two integers a and b is defined as the largest integer that can divide both a and b without a remainder. for example, the gcd of 30 and 54 is 6, whereas the gcd of 7 and 5 is 1. the following procedure was developed by euclid to compute the greatest common divisor of two positive integers a and b. in this exercise, we will prove the correctness of this algorithm. procedure euclidean(a, b) 1 x ← a 2 y ← b 3 while x 6= y do 4 if x > y then 5 x ← x βˆ’ y 6 else 7 y ← y βˆ’ x 8 return x (a) state the loop invariant for the while loop in this procedure. (b) prove the loop invariant. (c) prove that procedure euclidean always terminates provided that a and b are positive integers. (d) using the termination property of your loop invariant, prove that procedure euclidean computes and returns the greatest common divisor of a and b.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
During a steady flow process, the change of energy with respect to time is zero. a)- true b)- false
Answers: 2
question
Engineering, 04.07.2019 18:10
Burgers vector is generally parallel to the dislocation line. a)-true b)-false
Answers: 2
question
Engineering, 04.07.2019 18:10
An ideal otto cycle with air as the working fluid has a compression ratio of 8. the minimum and maximum temperatures in the cycle are 300 k and 1340 k. use constant specific heats at room temperature to determine (a) the amount of heat transferred to the air during the heat- addition kj/kg, (b) the thermal efficiency, and (c) the thermal efficiency of a carnot cycle ope limits. process, in rating between the same temperature
Answers: 2
question
Engineering, 04.07.2019 19:20
A21-tooth spur pinion mates with a 28-tooth gear. the diametral pitch is 3 teeth/in and the pressure angle is 20Β°, find the following values: the addendum, dedendum, circular pitch, tooth thickness, and base circle diameters.
Answers: 2
You know the right answer?
The greatest common divisor (gcd) of two integers a and b is defined as the largest integer that can...
Questions
question
Mathematics, 05.05.2020 21:11
question
Advanced Placement (AP), 05.05.2020 21:11
question
Biology, 05.05.2020 21:11