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

Other questions on the subject: Engineering

image
Engineering, 03.07.2019 23:20, abbz13
Two technicians are discussing the intake air temperature (iat) sensor. technician a says that the computer uses the iat sensor as a backup to the engine coolant temperature (ect) sensor. technician b says that the powertrain control module (pcm) will subtract the calculated amount of fuel if the air measures hot. who is correct
Answers: 3
image
Engineering, 04.07.2019 18:10, wyattlb97
Water at the rate of 1 kg/s is forced through a tube with a 2.5 cm inner diameter. the inlet water temperature is 15°c, and the outlet water temperature is 50°c. the tube wall temperature is 14°c higher than the local water temperature all along the length of the tube. what is the length of the tube?
Answers: 3
image
Engineering, 04.07.2019 19:10, Mimidj9279
The sum of the normal stresses does not change as the stress state rotates through an angle. a)-trune b)- false
Answers: 2
image
Engineering, 04.07.2019 19:10, jennymares
Abarometer contains mercury with a density of 13600 kg/m3. atmospheric conditions are 95.8 kpa and 20 °c at 20 °c, the vapor pressure of the mercury is 0.000173 kpa. the column of mercury will rise to a height of most nearly. select one: a)- 0.38 m b)- 0.82 m c)- 0.48 m d)- 0.72 m
Answers: 1
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 in other subjects:

Konu
Mathematics, 08.10.2019 08:30
Konu
Health, 08.10.2019 08:30