i thnk n/2 swaps are required... 1/4 is of the total glasses present.. i.e.
2n/4 ..=n/2

On Mon, Sep 5, 2011 at 11:52 AM, sachin goyal <[email protected]> wrote:

> PLEASE CORRECT ME ADITYA
>
>
> On Mon, Sep 5, 2011 at 11:52 AM, sachin goyal <[email protected]>wrote:
>
>> 12345|12345
>> FFFFF|EEEEE
>> WE HAVE TO CREATE THE PATTERN LIKE
>> F E F E F E F E F E
>> ACCORDING TO MY UNDERSTANDING WE CAN DIRECTLY REPLACE THE 2ND WITH SECOND
>> AND 4TH WITH 4TH
>> TELL CORRECT ME IF I AM WRONG AND I AM TRATING WRONG???????
>>
>>
>>
>> On Sun, Sep 4, 2011 at 8:04 PM, *$* <[email protected]> wrote:
>>
>>> yes n/4 swaps are required. +1 aditya kumar
>>>
>>>
>>> On Sun, Sep 4, 2011 at 6:32 PM, aditya kumar <
>>> [email protected]> wrote:
>>>
>>>> swap n/2-1 with n/2+1 , and then n/2-3 with n/2+3 till we reach n-1 .
>>>> so we need n/4 swaps .
>>>>
>>>>
>>>> On Sun, Sep 4, 2011 at 5:28 PM, Anup Ghatage <[email protected]> wrote:
>>>>
>>>>> That's interesting.
>>>>>
>>>>> when n = 3
>>>>>
>>>>> We have been given this :F F F | E E E
>>>>>
>>>>> Swap the middle element and it becomes: F E F | E F E
>>>>>
>>>>> Which is what you want, but when n = 5
>>>>>
>>>>> F F F F F | E E E E E
>>>>>
>>>>> And you swap the middle element it becomes: F F E F F | E E F E E
>>>>>
>>>>> So the same startegy doesn't apply.
>>>>>
>>>>> But if you do with from the center for every alternate element, it
>>>>> works
>>>>>
>>>>> for n = 3
>>>>>
>>>>> F F F | E E E > F F E | F E E > E F E | E F E
>>>>>
>>>>> It also works for n = 5 etc. So, It is a more uniform solution if you
>>>>> may.
>>>>>
>>>>>  --
>>>>> 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.
>>>>
>>>
>>>
>>>
>>> --
>>> Thx,
>>> --Gopi
>>>
>>>
>>>  --
>>> 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.
>



-- 
*Dheeraj Sharma*
Comp Engg.
NIT Kurukshetra
+91 8950264227

-- 
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