Implement a depth-first solution to the water jugs problem: There are two jugs, one holding 3 gallons

Question:

Implement a depth-first solution to the water jugs problem:

There are two jugs, one holding 3 gallons and the other 5 gallons of water. A number of things that can be done with the jugs: they can be filled, emptied, and dumped one into the other either until the poured-into jug is full or until the poured-out-of jug is empty. Devise a sequence of actions that will produce 4 gallons of water in the larger jug. (Hint: only integer values of water are used.)

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: