Tuesday, November 08, 2005

Average Salary

Three coworkers would like to know their average salary. However, they are self-conscious and don't want to tell each other their own salaries, for fear of either being ridiculed or getting their houses robbed. How can they find their average salary, without disclosing their own salaries?

3 Comments:

At 7:46 PM, Blogger Foobar said...

Each one say A B C adds some value to their salaries and says it out say x1 y1 z1

Now they calculate
x + x1 + y+ y1 + z + z1 / 3 = DA
(x + y + z) + (x1 + y1 + z1) = 3DA
-- Eq 1

Now each person subtracts his value such that
x + y + y1 + z + z1 = 3DA - x1 = DA1
x + x1 + y + z + z1 = 3DA - y1 = DA2
x + x1 + y + y1 + z = 3DA - z1 = DA3

Adding all these,
3(x+y+z) + 2(x1+y1+z1) = DA'

From Eq 1,
this becomes

(x+y+z) + 2[3DA] = DA'

=> (x+y+z) = DA' - 6DA

Then each can find avg sal.

 
At 3:32 AM, Blogger sreehari said...

can you please explain this with numbers ?

 
At 2:45 PM, Blogger Ishai said...

much simpler:
The first write on a paper a random number R (some order of magnitude of their salaries) and give it to the second one.
The second one add his salary and write (R+X2) on a paper and give it to the third.
The third adds is salary and write it on another paper (R+X2+x3) and give it the first again.
The first subtract R, adds X1 and tell everybody the sum.
No one call tell anything from the paper he got.

 

Post a Comment

<< Home