• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Glass arrangement

 
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


You are looking down at nine glasses labeled 1-9. All are half filled with milk and are arranged in a 3 x 3 pattern as shown above. The following actions are performed to the glasses: Glass 4 is switched with glass 6 after glass 8 is emptied into 6. Glass 7 is emptied into glass 1. Glass 8 is moved to where glass 5 sits, while glass 5 moves to where glass 3 sits, and glass 3 is placed where 8 began. Glass 2 is emptied into glass 4. Glass 6 is emptied into glass 7, and switches places with glass 8.

Referring to the actions above, what will be the possible arrangement of the glasses
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the role of the action 'emptying'? shld the glasses be arranged in the order of the quantity?
 
Sameer Jamal
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Emptied" means pouring all the content of the source glass to destination. Arrangement of galsses should be shown after swapping including their content.
 
bhuvan sundar
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the final arrangement:


1(full) 2(empty) 5(1/2 full)
8(empty) 6(empty) 4(full)
7(full) 3(1/2 full) 9(1/2 full)
[ October 04, 2005: Message edited by: bhuvan sundar ]
 
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1 2 3
4 5 6
7 8 9


You are looking down at nine glasses labeled 1-9. All are half filled with milk and are arranged in a 3 x 3 pattern as shown above.

The following actions are performed to the glasses:
Let me use following notations

E=Empty
F=Full
H=Half

Glass 4 is switched with glass 6 after glass 8 is emptied into 6.

At first,
1H 2H 3H
4H 5H 6H
7H 8H 9H

Emptying 8 into 6
1H 2H 3H
4H 5H 6F
7H 8E 9H

Switching 4 with 6
1H 2H 3H
6F 5H 4H
7H 8E 9H



Glass 7 is emptied into glass 1.
1F 2H 3H
6F 5H 4H
7E 8E 9H

Glass 8 is moved to where glass 5 sits, while glass 5 moves to where glass 3 sits, and glass 3 is placed where 8 began.
1F 2H 5H
6F 8E 4H
7E 3H 9H


Glass 2 is emptied into glass 4.
1F 2E 5H
6F 8E 4F
7E 3H 9H


Glass 6 is emptied into glass 7, and switches places with glass 8.
1F 2E 5H
6E 8E 4F
7F 3H 9H

1F 2E 5H
8E 6E 4F
7F 3H 9H

Hey its cool. Liked it very much.
----------------
 
Sameer Jamal
Ranch Hand
Posts: 1871
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Akhil do you work for CMM Level 5 company
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic