## March 13, 2008

### 4 Quarts

You have a 3-quart bucket, a 5-quart bucket, and an infinite
"supply of water. How can you measure out exactly 4 quarts?

God.V said...

i need an extra container to collect the 4 quarts of water..
then there are two ways..

1.fill the 5q bucket with the 3q bucket water..twice..excess 1q of water is collected in the container..then add 3q to it using the respective bucket..

2.fill the 3q bucket with 5q twice each time emptying the 3q bucket...excess 4q is collected in the container..

Secret SquÃ¯rrel said...

"God" is wrong again!! When will it end?

The problem clearly states that you are given only a 3- and 5- quart container. You can't just decide to add in a container of you own! Why not just make the container that you bring along a 4-quart one and be done with it?

There are several ways to do this but the following is pretty efficient.

Fill the 5-quart container and then fill the 3 from the 5. That leaves 2 quarts in the 5. Empty out the 3. Pour the remaining 2 quarts from the 5 into the 3.

Fill the 5 again and top up the 3 (this requires 1 quart). That leaves 4 quarts in the 5.

Anmsoft said...

Fill the 5q bucket, empty to the 3q bucket, 2q would be left in 5q, put 2q into the target, empty the 3q bucket.
Repeat the same.

Suresh Kumar N. said...

3 5
-----------
3->3 0
0(3->)3
3->3 3
1(2->)5
1 0 ->5
0(1->)1
3->3 1
0(3->)4

Babu vincent said...

5l------3l
**********
5-------0
2-------3
2-------0
0-------2
5-------2
4-------1*filled---6steps

else

5l------3l
**********
0-------3
3-------0
3-------3
5-------1
0-------1
1-------0
1-------3
4-------0*filled--8steps

Babu vincent said...

5l------3l
**********
5-------0
2-------3
2-------0
0-------2
5-------2
4-------3*filled---6steps

Anonymous said...

Please look at this post for the easiet solution --

ayush said...

I got a better question for all of you,, assume you have three containers of 8L, 5L, 3L capacity and 8L container is filled completely with milk(not water), separate 4L of milk in any of the containers(obviously either 5L or 8L)
Constraint : you can't throw away the milk :P