Assignment 1 - Problem Solving
Assignment 1 - Problem Solving
SN Attempt all the questions. All the questions carry equal marks. The use of COs Marks
CHATGPT is strictly prohibited.
1 Suppose there are 1234 players in a tournament. Each game in the tournament is knockout CO1 10
(i.e., two players will play, and the loser will not play anymore, and the winner carries on).
How many games are played before the tournament winner is decided?
2 There are x empty boxes placed on a table. An unknown number of the boxes is selected CO1 10
and into each y medium boxes are placed. An unknown number of the medium boxes is
selected and into each y small boxes are placed. At the end of this process there are k empty
boxes. How many boxes are there in total? What is the invariant in this problem?
3 Five couples (president and bodyguard) wish to cross a river. They have one boat that can CO1 10
carry at most two people, making several trips across the river necessary. The presidents are
nervous of the other presidents’ bodyguards so that none is willing to be on a bank or in the
boat with another president’s bodyguard unless their own bodyguard is also present. How
can all five couples get across the river?
4 Five people wish to cross a bridge. It is dark, and it is necessary to use a torch when crossing CO1 10
the bridge, but they have only one torch between them. The bridge is narrow, and only two
people can be on it at any one time. The five people take different amounts of time to cross
the bridge, when two crosses together they proceed at the speed of the slowest. The first
person takes 1 minute to cross, the second 2 minutes, the third 5 minutes, the fourth 10
minutes and the fifth takes 20 minutes. The torch must be ferried back and forth across the
bridge, so that it is always carried when the bridge is crossed. Determine the minimum time
so that all five can cross the bridge.
5 A person has 3000 bananas and a camel. The person wants to transport the maximum CO1 10
number of bananas to a destination which is 1000 KMs away, using only the camel as a
mode of transportation. The camel cannot carry more than 1000 bananas at a time and eats
School of Computer Science Assignment 1
a banana every km it travels. What is the maximum number of bananas that can be
transferred to the destination using only camel (no other mode of transportation is allowed).
6 In a matchstick game, players take turns removing 1, or 2, or 3 matchsticks from a pile. The CO2 10
player who takes the last matchstick wins. In the matchstick game with n matchsticks
initially, define a winning position, winning strategy, and formulate winning algorithm.
7 There are 21 matchsticks, and players can remove 1, 2, 3 or 4 matchsticks on their turn. The CO2 10
player forced to take the last matchstick loses. Determine the winning and losing positions.
Determine the Grundy numbers also.
8 The game starts with 3 piles having 3, 4 and 5 matchsticks, and the player to move may take CO2 10
any positive number of matchsticks up to 3 only from any of the piles [Provided that the
pile has that many number of matchsticks]. The last player to move wins. Which player
wins the game if both players play optimally? Determine the winning and losing positions.
What are the winning strategies in this case?
9 The game starts with 3 piles having 7, 10 and 12 matchsticks, and the player to move may CO2 10
take any positive number of matchsticks from 1, 3 and 4 only from any of the piles [Provided
that the pile has that many number of matchsticks]. The last player to move wins. Which
player wins the game if both players play optimally? Determine the winning and losing
positions. What are the winning strategies?
10 Two players alternately name dates. The winner is the player who is named 3lst December, CO2 10
and the starting date is 1st January (non-leap year). A player can name either the 1st of the
next month or increase the day of the month by at max 10 days leaving the month
unchanged. Determine the winning and losing positions, and the winning strategies.