Sunday, 22 December 2013

River Crossing Problem

Question 1

Four people need to cross a rickety bridge at night. Unfortunately, they have only one torch and the bridge is too dangerous to cross without one. The bridge is only strong enough to support two people at a time. Not all people take the same time to cross the bridge. Times for each person:  1 min, 2 mins, 7 mins and 10 mins. What is the shortest time needed for all four of them to cross the bridge?

Answer

The initial solution most people will think of is to use the fastest person as an usher to guide everyone across. How long would that take? 10 + 1 + 7 + 1 + 2 = 21 mins. Is that it? No. That would make this question too simple even as a warm up question.

To reduce the amount of time, we should find a way for 10 and 7 to go together.
So the solution is

1 and 2 go cross
2 comes back
7 and 10 go across
1 comes back
1 and 2 go across (done)

Total time = 2 + 2 + 10 + 1 + 2 = 17 mins


Question 2

A guard is positioned at the one side of bridge say 'A'.
* His task is to shoot all those who try to leave from 'A' to other side say 'B'.
* He also need to welcome the person who come from other side 'B' to his side 'A'.

The guard comes out of his post every 1 hour and looks down the bridge for any people trying to leave.
Monica a brilliant girl is at side 'A' and wish to go to other side 'B'. She also know's it would take her 1:45 hr to cross the river.

She comes with an super idea and able to cross the river.How did Monica cross the river ? 

Answer

Steps
1. Monica go from side A to B for approx 59 minutes
2. Lisa then move back to side A for 2 minutes to fool guard. Now guard will think she is coming to side A.
3. then she again move toward B

No comments:

Post a Comment

t> UA-39527780-1 back to top