doesnt ur soln fails for even n?
suppose initial config : FFFF||EEEE
now starting with second & n +2 th
FEFF||EFEE
next 4, n+4:
FEFE || EFEF
4th & 5th EE are continuous, correct me if m wrong:
my soln wud rather start with swaping 2nd & 2n - 2 th element... n/4
swaps...

On Sun, Sep 4, 2011 at 3:24 PM, SHIVAM AGRAWAL <[email protected]> wrote:

> There are 2n glasses standing next to each other in a row, the first n of
> them are filled with
> a soda drink, while the remaining n glasses are empty. Make the glasses
> alternate in a filledempty-
> filled-empty pattern in the minimum no of glass moves.
>
>
> my soln is start with 2nd and (n+2)th swap them
> and then move to 4th and n+4th  this is to be
> done n/2 times.....total swaps are n/2  .. and
> total moves n/2*2  ie n...
>
>
> mine is n moves ...any1 with some better answer ???
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

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

Reply via email to