Joey has to arrange 2N sandwiches which are wrapped by different color wrapper in N pairs such that he can feed his N girlfriends (A hypothetical situation it is where we have to ignore the fact “JOEY DOESN’T SHARE FOOD ”). He has to serve them for 2N-1 Days. Girls don’t like repeated pair of color wrapper of their sandwiches.
Design an algorithm for joey so that for 2N-1 days no pair would be same.
Hint: One can solve problem by using 2*N table.
Here is one of the way to generate 2N-1 sets of different pairs efficiently. For convenience, number the different color from 1 to 2N and place these numbers in a 2N table. The pairs for the first set are given by the columns of this table. To generate the next 2N −2 sets, rotate—say, clockwise—all the entries except 1 in the last generated table.
Figure shows the example for N = 3. The entry 1 is fixed and all other entries are rotated clockwise.
References: The algorithm can be thought of as based on the representation change strategy. Both interpretations of the algorithm outlined above were given by Maurice Kraitchik in Mathematical Recreations [Kra53, pp. 226–227].
This puzzle is contributed by Antara Purohit. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
- 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)