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 03:10
What precautions should you take to prevent injuries when dealing with heavy loads?
Answers: 1
question
Engineering, 04.07.2019 18:10
Journeyman training is usually related (clo2) a)-to specific tasks b)-to cost analysis of maintenance task c)-to control process to ensure quality d)-to installation of machinery
Answers: 2
question
Engineering, 04.07.2019 18:20
Derive the correction factor formula for conical nozzle i=-(1+ cosa) and calculate the nozzle angle correction factor for a nozzle whose divergence hal-fangle is 13 (hint: assume that all the mass flow originates at the apex of the cone.
Answers: 3
question
Engineering, 04.07.2019 19:10
The maximum shear stress and maximum flexural stress occur at the same location along a beam subjected to a non-uniform bending load. a)-trune b)- false
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
Advanced Placement (AP), 17.12.2020 02:50
question
Mathematics, 17.12.2020 02:50
question
Computers and Technology, 17.12.2020 02:50
question
Biology, 17.12.2020 02:50
question
Biology, 17.12.2020 02:50
Questions on the website: 13722363