Fog Creek Software
Discussion Board




Average salary solution

The given solution is overcomplicated, and takes two full rounds, when just one will do:

The first (A) enters his salary (SA) plus/minus a random number and writes the result on a note to give to B.

B adds his salary, then writes the sum on a new note and sends to C.

C adds his salary and gives the final result to A who subtract the original random number, and announces the sum.

The only possible problem is that if A snatch the note B is giving to C, then he will know B's salary. However, as noted in the original solution, all three will know the average of the two others' salary.

Terje

Terje Mathisen
Wednesday, February 02, 2005

Here is my solution though it does involves a long approach. All three of them will choose any number of their choise and then multiply their corresponding salary with that number. Lets say the A, B and C are three persons choose p,q and r as the respective numbers and after muliplying their salary becomes p(SA), q(SB) n r(SC).

Now eachone passes this multiplied salary to other two (one by one) and they multiply it with their corresponding chosen numbers. So each figure now turns to pqr(SA), pqr(SB) and pqr(SC).

They can add up this figure and get the average of the 3 diving the final figure individually by their chosen numbers.

Vivek Gupta
Tuesday, February 08, 2005

My solution is simple, has no fancy math, and is easily scaleable to more then three people:

Each person, in private, counts out their salary using Monopoly (tm) money (or any other type of token), then slips it, loose, into a ballot box.  When all have done so, open the box, count the total and divide by the number of people.

Jeff Stoltzfus
Wednesday, February 16, 2005

My solution is simple, has no fancy math, and is easily scaleable to more than three people:

Each person, in private, counts out their salary using Monopoly (tm) money (or any other type of token), then slips it, loose, into a ballot box.  When all have done so, open the box, count the total and divide by the number of people.

Jeff Stoltzfus
Wednesday, February 16, 2005

*  Recent Topics

*  Fog Creek Home