You have two containers with capacities a = 5, b = 3 liters. The objective is to
ID: 673289 • Letter: Y
Question
You have two containers with capacities a = 5, b = 3 liters. The objective is to obtain exactly c liters into one of the containers. You can only perform the following operations: • Fill a container to the top, • Empty a container completely, • Pour the liquid from one container to the other. (a) Describe how to solve the “Die Hard” problem when a = 5, b = 3 and c = 4. How do you solve the problem if c = 1? (b) Discuss how to solve the problem when a = 12, b = 9 and c = 4. (c) Describe the condition required of a and b so that you can always solve the problem for any 1 c max(a, b)?
Explanation / Answer
a. a = 5. b = 3. c = 4.
1. Fill 5 liter Jug. (5-liter jug holds 5 liter, and 3 liter jug is empty.)
2. Fill the 3 liter jug from 5 liter jug. (5-liter jug holds 2 liters now, and 3 liter jug is full.)
3. Empty 3 liter jug. (5-liter jug holds 2 liters now, and 3 liter jug is empty.)
4. Pour the water from 5-liter jug to 3-liter jug. (5-liter jug is empty, and 3-liter jug is holding 2-liter now.)
5. Fill the 5-liter jug. (5-liter jug is full with 5-liters and 3-liter jug is holding 2-liter now, with 1-liter space to hold.)
6. Finally, filling the 3-liter jug from 5-liter jug, will make the 5-liter jug to be left with 4-liter liquid.
If a = 5, b = 3, c = 1.
1. Fill the 3 liter jug. (5-liter jug is empty and 3-liter jug is full with 3-liter liquid.)
2. Pour the 3-liter liquid from 3-liter jug to 5-liter jug. (5-liter jug is holding 3-liter liquid, and 3-liter jug is empty.)
3. Fill the 3 liter jug again. (5-liter jug is holding 3-liter liquid, and 3-liter jug is full.)
4. Finally, filling the 5-liter jug from 3-liter jug will take 2 liters from it, and the 3-liter jug will be left with 1 liter.
b. a = 12. b = 9. c = 4.
This problem cannot be solved. i.e., using a 12-liter jug, and a 9-liter jug, you can't measure 4 liters, with whatever operations you do.
c. The condition required of a and b so that you can always solve the problem for any 1 <= c <= max(a,b) is, a and b should be co-primes.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.