Table of contents | |
Introduction | |
Problem Statement | |
Steps to Follow | |
Calculation of Average Salary | |
Explanation | |
Conclusion |
Have you ever been in a situation where you wanted to know the average salary of a group of people, but you were not allowed to share individual salaries? Here's a solution to that problem.
How to Find Average Salary without Disclosing Individual Salaries
1. X adds a Random Number and his salary and tells the sum to Y.
2. Y also adds a Random Number and his salary to the sum told by X and tells the new sum to Z.
3. Z also adds a Random Number and his salary to the sum told by Y and tells the new sum to X.
4. X subtracts its random number from the sum told by Z and tells the new number to Y.
5. Y subtracts its random number from the sum told by X and tells the new number to Z.
6. Z subtracts its random number from the sum told by Y and announces the new number.
The new number announced by Z is now the sum of the three salaries, and the average can be calculated by dividing the sum by 3. This way, nobody knows the salary of others, but all know the average.
To understand this process better, let's take an example. Suppose X, Y, and Z have salaries of $50,000, $60,000, and $70,000, respectively. They want to know the average of their salaries without disclosing their individual salaries.
X adds a random number, say 5, to his salary and tells the sum, which is $50,005, to Y. Y adds a random number, say 7, to his salary and the sum told by X, which is $110,012, and tells the new sum, which is $110,019, to Z.
Z also adds a random number, say 3, to his salary and the sum told by Y, which is $170,022, and tells the new sum, which is $170,025, to X. X subtracts his random number, which is 5, from the sum told by Z, which is $170,020, and tells the new number, which is $170,015, to Y.
Similarly, Y subtracts his random number, which is 7, from the sum told by X, which is $120,024, and tells the new number, which is $120,017, to Z. Finally, Z subtracts his random number, which is 3, from the sum told by Y, which is $180,029, and announces the new number, which is $180,026.
Therefore, the sum of the three salaries is $50,000 + $60,000 + $70,000 = $180,000, and the average salary is $180,000/3 = $60,000.
This method is a great way to find out the average salary of a group of people without disclosing individual salaries. It helps to maintain privacy and ensures that no one feels uncomfortable sharing their salary.
|
Explore Courses for Interview Preparation exam
|