cs31 Consider the following problem Rowena has three unmarke
cs31
Consider the following problem: Rowena has three unmarked glasses of different sizes: 3 ounces, 5 ounces, and 8 ounces. The largest glass is full. What can Rowena do to get 4 ounces of liquid into each of the larger two glasses? Redo question 1 by drawing partial state space. In DFS, at each step, we have a tree that spans the partial space consisting of the sets of CLOSED and OPEN nodes. For example, *: CLOSED #: OPEN step 1: Visit (8, 0, 0) start node (8, 0, 0)* | |-- (3, 5, 0)# |-- (5, 3, 0)# step 2: Visit(3, 5, 0) (8, 0, 0)* | |--(3, 5, 0)* | | ||-- (0, 5, 3)# ||-- (3, 2, 3)# | | |--(5, 3, 0)# Complete all steps by drawing a different tree at each step.Solution
1. Rowena has three unmarked glasss :
Given: The largest glass is full.
To get 4 ounces of liquid into larger two glass following are the steps:
Step1:Pour 5 ounces glass from 8 ounces filled glass
8 ounces 5 ounces 3 ounces
3 5 0
Step2: Pour 3 ounces glass from 5 ounces filled glass
8 ounces 5 ounces 3 ounces
3 2 3
Step3:Now empty 3 ounces glass and fill that in 8 ounces glass
8 ounces 5 ounces 3 ounces
6 2 0
Step4: Now empty 5 ounces glass and fill that in 3 ounces glass
8 ounces 5 ounces 3 ounces
6 0 2
Step5: Pour 5 ounces glass from 8 ounces glass.
8 ounces 5 ounces 3 ounces
1 5 2
Step6: Pour 1 ounces of liquid from 5 ounces glass to 3 ounces glass
8 ounces 5 ounces 3 ounces
1 4 3
Step7: Now Empty the 3 ounces glass and fill that liquid in 8 ounces glass
8 ounces 5 ounces 3 ounces
4 4 0
Finally, we have got largest two glasses with 4 ounces of liquid each.
