Solution Found!

Pouring water. We have three containers whose sizes are 10 pints, 7 pints, and 4 pints

Chapter 3, Problem 3.8

(choose chapter or problem)

Get Unlimited Answers
QUESTION:

Pouring water. We have three containers whose sizes are 10 pints, 7 pints, and 4 pints, respectively. The 7-pint and 4-pint containers start out full of water, but the 10-pint container is initially empty. We are allowed one type of operation: pouring the contents of one container into another, stopping only when the source container is empty or the destination container is full. We want to know if there is a sequence of pourings that leaves exactly 2 pints in the 7- or 4-pint container.

(a) Model this as a graph problem: give a precise definition of the graph involved and state the specific question about this graph that needs to be answered.

(b) What algorithm should be applied to solve the problem?

Questions & Answers


(1 Reviews)

QUESTION:

Pouring water. We have three containers whose sizes are 10 pints, 7 pints, and 4 pints, respectively. The 7-pint and 4-pint containers start out full of water, but the 10-pint container is initially empty. We are allowed one type of operation: pouring the contents of one container into another, stopping only when the source container is empty or the destination container is full. We want to know if there is a sequence of pourings that leaves exactly 2 pints in the 7- or 4-pint container.

(a) Model this as a graph problem: give a precise definition of the graph involved and state the specific question about this graph that needs to be answered.

(b) What algorithm should be applied to solve the problem?

ANSWER:

Step 1 of 3

The graph data structure is used for solving problems like social networking, state machine modeling, and other computational problems. In general, a graph contains vertices and edges. The vertices represent the nodes and the edges represent the path between the nodes.

Add to cart

Reviews

Review this written solution for 759558) viewed: 1602 isbn: 9780073523408 | Algorithms - 1 Edition - Chapter 3 - Problem 3.8

Thank you for your recent purchase on StudySoup. We invite you to provide a review below, and help us create a better product.

Textbook: Algorithms

Click to rate

Write a review below (optional):

Submit Review
×

Thanks for your review!

Think of all the students you've helped. Nice job!


Study Tools You Might Need

Not The Solution You Need? Search for Your Answer Here:

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back