First guy is a coin toss - let's wish him good luck.
His job is to establish the parity of black hats visible to him.
He says "Black" if he sees an odd number of black hats; "Red" otherwise.
By paying attention to what has been said, each prisoner will know his hat's
color.

*Example:*
Second to speak hears "Black" and sees an even number of black hats.
He knows his hat is black [odd changed to even - must be his is black] and
says "black".

Third guy has heard "black" and "black" and sees an even number of black
hats.
He knows his hat is red [even stayed even - his hat can't be black] and says
"red".

And so on, to the front of the line.

*General algorithm:*
The first time you hear "black", say to yourself "odd".
Each time your hear "black" after that, change the parity: "even", "odd",
... etc.
When it's your turn, if the black hats you see match the running parity,
you're Red; Black otherwise.
Call out your color.

On Fri, Mar 4, 2011 at 7:51 PM, rajul jain <[email protected]> wrote:

>
> they only hear the answer given by prisoner
>
> On Fri, Mar 4, 2011 at 6:43 PM, rajul jain <[email protected]> wrote:
>
>> they can see persons in front of them.
>>
>>
>> On Fri, Mar 4, 2011 at 6:42 PM, rajul jain <[email protected]>wrote:
>>
>>> @vipin if thay can hear then then what would be the purpose of this
>>> question
>>> then last person just sacrifice himself and just tell the color of hat of
>>> person standing in front  of him
>>> dont give this type of comments
>>> keep in mind "No communication" rule in this question
>>> On Fri, Mar 4, 2011 at 5:53 PM, Vipin Agrawal 
>>> <[email protected]>wrote:
>>>
>>>> If they cant hear than what the point to create strategy ?
>>>>
>>>> On Mar 4, 2:40 pm, Tushar Bindal <[email protected]> wrote:
>>>> > can't they hear what the previous person has just said?
>>>>
>>>> --
>>>> 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