Computer Science: An Overview: Global Edition (12th Edition)

Published by Pearson Higher Education
ISBN 10: 1292061162
ISBN 13: 978-1-29206-116-0

Chapter 5 - Algorithms - Chapter Review Problems - Page 264: 19

Answer

No, both will have same amount

Work Step by Step

Let us assume the capacity of small glass is X ml. So after pouring wine, the large glass will have X ml of wine. Now let us say we poured Y ml of water in the large glass. The first observation we make is $Y\leq X$, because we are pouring some water from small glass so it can be at max the capacity of small glass that is X. So now there will be X ml wine and Y ml water in the large glass. Now we will refill the smaller glass with Y ml content of large glass. Since the wine and water is mixed in large glass the wine sent into the small glass will be- $\frac{X}{X+Y}\times Y$ The water sent in the small glass will be- $Y - $ wine sent in small glass => $Y- \frac{X}{X+Y}\times Y$ The water left in the large glass will be- $Y-$ water sent in the small glass => $Y - (Y- \frac{X}{X+Y}\times Y)$ = $\frac{X}{X+Y}\times Y$ This is the same as the amount of wine in the small glass. The trick is defining variables and tracking the amounts of wine and water explicitly, instead of trying to reason qualitatively.
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.