No need to enumerate all possible states.
In the final state (2,8,5), each jug is neither full nor empty, while every valid operation has to fill or empty one jug. So it is not possible to get this state from any other state by one valid operation. (As others said, the state before the final one does not exist)


On 2010-6-10 0:35, Dave wrote:
Assuming that the only moves you can make are to pour the contents of
one jug into another until either the source is empty or the
destination is full, the following are the only positions possible:

  0: initial position                                       (15,0,0)
  1: starting from  0, pour 10 from jug 1 to jug 2, getting (5,10,0)
  2: starting from  0, pour  6 from jug 1 to jug 3, getting (9,0,6)
  3: starting from  1, pour  5 from jug 1 to jug 3, getting (0,10,5)
  4: starting from  1, pour  6 from jug 2 to jug 3, getting (5,4,6)
  5: starting from  2, pour  9 from jug 1 to jug 2, getting (0,9,6)
  6: starting from  2, pour  6 from jug 3 to jug 2, getting (9,6,0)
  7: starting from  3, pour 10 from jug 2 to jug 1, getting (10,0,5)
  8: starting from  4, pour  6 from jug 3 to jug 1, getting (11,4,0)
  9: starting from  5, pour  6 from jug 3 to jug 1, getting (6,9,0)
10: starting from  6, pour  6 from jug 1 to jug 3, getting (3,6,6)
11: starting from  7, pour  5 from jug 3 to jug 2, getting (10,5,0)
12: starting from  8, pour  4 from jug 2 to jug 3, getting (11,0,4)
13: starting from  9, pour  6 from jug 2 to jug 3, getting (6,3,6)
14: starting from 10, pour  4 from jug 3 to jug 2, getting (3,10,2)
15: starting from 11, pour  6 from jug 1 to jug 3, getting (4,5,6)
16: starting from 12, pour 10 from jug 1 to jug 2, getting (1,10,4)
17: starting from 13, pour  6 from jug 3 to jug 1, getting (12,3,0)
18: starting from 14, pour 10 from jug 2 to jug 1, getting (13,0,2)
19: starting from 15, pour  5 from jug 3 to jug 2, getting (4,10,1)
20: starting from 16, pour  2 from jug 2 to jug 3, getting (1,8,6)
21: starting from 17, pour  3 from jug 2 to jug 3, getting (12,0,3)
22: starting from 18, pour  2 from jug 3 to jug 2, getting (13,2,0)
23: starting from 19, pour 10 from jug 2 to jug 1, getting (14,0,1)
24: starting from 20, pour  6 from jug 3 to jug 1, getting (7,8,0)
25: starting from 21, pour 10 from jug 1 to jug 2, getting (2,10,3)
26: starting from 22, pour  6 from jug 1 to jug 3, getting (7,2,6)
27: starting from 23, pour  1 from jug 3 to jug 2, getting (14,1,0)
28: starting from 25, pour  3 from jug 2 to jug 3, getting (2,7,6)
29: starting from 27, pour  6 from jug 1 to jug 3, getting (8,1,6)
30: starting from 28, pour  6 from jug 3 to jug 1, getting (8,7,0)

Since {2,8,5) doesn't appear on the list, the puzzle has no solution.

Dave

On Jun 7, 3:32 am, sharad<sharad20073...@gmail.com>  wrote:
: Three containers are of 15,10 and 6 ltrs capacity. Initially its in
configuration (15,0,0). Make it to configuration (2,8,5)

--
You received this message because you are subscribed to the Google Groups "Algorithm 
Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to