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
Apump is used to circulate hot water in a home heating system. water enters the well-insulated pump operating at steady state at a rate of 0.42 gal/min. the inlet pressure and temperature are 14.7 lbf/in.2, and 180°f, respectively; at the exit the pressure is 60 lbf/in.2 the pump requires 1/15 hp of power input. water can be modeled as an incompressible substance with constant density of 60.58 lb/ft3 and constant specific heat of 1 btu/lb or. neglecting kinetic and potential energy effects, determine the temperature change, in °r, as the water flows through the pump.
Answers: 1
question
Engineering, 04.07.2019 18:10
Acompressor receives the shaft work to decrease the pressure of the fluid. a)- true b)- false
Answers: 3
question
Engineering, 04.07.2019 18:10
Different types of steels contain different elements that alter the characteristics of the steel. for each of the following elements, explain what the element does when alloyed with steel.
Answers: 2
question
Engineering, 04.07.2019 18:10
Consider a large isothermal enclosure that is maintained at a uniform temperature of 2000 k. calculate the emissive power of the radiation that emerges from a small aperture on the enclosure surface. what is the wavelength ? , below which 10% of the emission is concentrated? what is the wavelength ? 2 above which 10% of the emission is concentrated? determine the wavelength at which maximum spectral emissive power occurs. what is the irradiation incident on a small object placed inside the enclosure?
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
Spanish, 27.07.2019 09:00
question
English, 27.07.2019 09:00
question
Mathematics, 27.07.2019 09:00
question
Health, 27.07.2019 09:00
question
Mathematics, 27.07.2019 09:00
Questions on the website: 13722367