Consider the following code fragment. Assume the loop body follows the given invariant and progress metric....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the following code fragment. Assume the loop body follows the given invariant and progress metric. int x = 20, y = 2, z = 10 /** updates x, y, z maintains x/y = #z * decreases Z */ while (x*y != 1000) { } What are possible values for the variables after the end of the loop? Consider the following code fragment. Assume the loop body follows the given invariant and progress metric. int x = 20, y = 2, z = 10 /** updates x, y, z maintains x/y = #z * decreases Z */ while (x*y != 1000) { } What are possible values for the variables after the end of the loop?
Expert Answer:
Answer rating: 100% (QA)
The given loop has the following annotations 1 Updates It indicates which variables are updated within the loop In this case its x y and z 2 Maintains ... View the full answer
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
1.) Pineapple Inc. issued a common stock for $30,000 and ended the period with net cash from financing of -$5,000. If the only other financing company was a payment of cash dividend, what is the...
-
Consider the following code fragment in a high-level language: Assume that Q is an array of 32-byte records and the VAL field is in the first 4 bytes of each record. Using x86 code, we can compile...
-
The following code fragment implements Horner?s rule for evaluating a polynomial The following code fragment implements Horner?s rule for evaluating a polynomial given the coefficients a 0, a 1 ??.,a...
-
Glass bottles can be either recycled (crushed and re-melted) or reused. The market will tend to choose the cheapest path. What factors will tend to affect the relative cost of these options? Is the...
-
Neglecting friction and the radius of the pulley, determine (a) The tension in cable ABD, (b) The reaction at C. 15 in. 30 Ib 20 in. 8 in. 8 in.
-
Please review this document and answer the following questions. Copy paste the following URL into your browser to see the financial statements:...
-
How does the strategic direction of the organization influence human resource planning activities?
-
Dillon Products manufactures various machined parts to customer specifications. The company uses a job-order costing system and applies overhead cost to jobs on the basis of machine-hours. At the...
-
A plate of plastic with parallel faces having a refractive index of 1.47 is resting on the surface of water in a tank. A ray of light coming from above in air makes an angle of incidence 34.0 with...
-
A piece-rate employee receives $30 for each desktop computer assembled and has a standard 40-hour workweek. During the weekly pay period ending December 16, 48 computers were assembled during 44...
-
Identify the marketing strategy or cognitive bias described in each situation. A minor league baseball team reduces the price of hot dogs to $1 at Thursday home games. A trial promotion for a...
-
As noted earlier, a planned court system that is similar to the Ohio commercial docket is the proposed science court. The science court would act as a forum for cases involving scientific and...
-
Define and distinguish between future value and present value.
-
What are the influences on the supply of U.S. dollars in the foreign exchange market?
-
Colombia is the worlds biggest producer of roses. The global demand for roses increases and at the same time Columbias central bank increases the interest rate. In the foreign exchange market for...
-
How is the supply of money determined and how does it depend on the Feds monetary policy strategy?
-
(4%) Problem 14: A student standing in a canyon yells "echo", and her voice produces a sound wave of frequency of f= 0.59 kHz. The echo takes t = 3.5 s to return to the student. Assume the speed of...
-
Use integration by parts to evaluate the following. Check your answer by taking the derivative. x2e-xdx
-
Argue that ANY-SEGMENTS-INTERSECT works correctly even if three or more segments intersect at the same point.
-
Consider an RSA key set with p = 11, q = 29, n = 319, and e = 3. What value of d should be used in the secret key? What is the encryption of the message M = 100?
-
Argue that if line 9 of PROTO-VEB-MINIMUM is executed, then the proto-vEB structure is empty.
-
Which of the following does not occur in the small intestine? (a) Bile from the gall bladder breaks fats into small droplets. (b) Nutrients are absorbed into the body. (c) Proteins are broken down....
-
Which blood vessels are responsible for nutrient and waste exchange with tissues?
-
Trace the path of blood through the body, beginning with blood returning from the tissues to the heart. Be sure to name each of the chambers of the heart.
Study smarter with the SolutionInn App