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
Which of the following refers to refers to how well the control system responds to sudden changes in the system. a)-transient regulation b)- distributed regulation c)-constant regulation d)-steady-state regulation
Answers: 1
question
Engineering, 04.07.2019 18:20
Acertain flow of air (at stp) has a velocity distribution given by v i (in ft/s). if this flow is going through a 4 ft square area in the yz-plane (centered at the origin), what is the mass flow rate (in lbm/s)?
Answers: 2
question
Engineering, 04.07.2019 18:20
Prove the equivalence between the two statements of the 2nd law of thermodynamics (i.e., a violation of one statement leads to the violatio the other statement)
Answers: 2
question
Engineering, 06.07.2019 02:30
In a unit cell of fcc structure, indicate the position of one of the tetrahedral interstitial sites by plotting the corresponding tetrahedron. do the same for one of the octahedral interstitial sites (in a separate fcc unit cell). mark the positions of all the tetrahedral and octahedral interstitial sites in the unit cells. how many equivalent tetrahedral sites and how many equivalent octahedral sites are contained in a fcc unit cell, respectively. what is the coordination number for a tetrahedral site and what is the coordination number for an octahedral site?
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, 09.04.2021 19:50
question
Mathematics, 09.04.2021 19:50
question
Mathematics, 09.04.2021 19:50
question
Mathematics, 09.04.2021 19:50
Questions on the website: 13722367