There are n students in a class, each in possession of a different personality attribute. As they are new in the school, so they want to know about each other. To help the students, the teacher decides to conduct an activity. The rule for the activity is that the students will share the personality attributes of each other through a series of bilateral conversations (e.g., via a telephone). Assume that in every conversation both parties exchange all the personality attributes they know at the time. What is the minimum number of conversations they need to guarantee that everyone of them gets all the personality attributes?
Let us denote the n students as S1, S2, S3, ………, Sn.
When the Number of students (n) = 1, then the number of conversations required is 0 as no bilateral conversation is possible.
For n = 2, the number of conversations required is 1 i.e, between S1 and S2.
For n = 3, three conversations are needed which are as (S1 with S2), (S2 with S3), (S1 with S3)).
For n = 4, four conversations are needed.
For n = 5, six conversations are needed.
For n = 6, eight conversations are needed.
The above figures shows the optimal personality attribute sharing via bilateral conversations. The sequential order of conversations is indicated by the labels on the edges connecting the vertices, representing the conversing parties. The order of conversations can vary.
The logic can be further extended to n = 7, 8 and so on. If observed then it can be seen that the total number of conversations in this algorithm is equal to 2(n – 4) + 4 = 2n – 4 where n >= 4.
What is the best way to make conversations ensuring minimality:
For n > 4, the solution for n = 4 can be extended by making each of students S5, S6, . . ., Sn talk with person S1 before S1 talks with S2, S3 with S4, S1 with S4 and S2 with S3 and then making S1 talk with each of students S5, S6, . . ., Sn for the second time.
Note: The order of conversations may vary but the total number of minimum conversations will remain same which can be clearly seen in images for n = 6.
- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 2 | (Find ages of daughters)
- Puzzle 3 | (Calculate total distance travelled by bee)
- Puzzle 4 | (Pay an employee using a 7 units gold rod?)
- Puzzle 13 | (100 Prisoners with Red/Black Hats)
- Puzzle 5 | (Finding the Injection for Anesthesia)
- Puzzle 6 | (Monty Hall problem)
- Puzzle 7 | (3 Bulbs and 3 Switches)
- Puzzle 8 | (Find the Jar with contaminated pills)
- Puzzle 9 | (Find the fastest 3 horses)
- Puzzle 10 | (A Man with Medical Condition and 2 Pills)
- Puzzle 11 | (1000 Coins and 10 Bags)
- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle 14 | (Strategy for a 2 Player Coin Game)
- Puzzle 15 | (Camel and Banana Puzzle)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.