Each man walks at a different speed. Stack Overflow for Teams is a private, secure spot for you and To support this aim, members of the An investigation involving adding and subtracting sets of consecutive numbers. Step 2: C and D cross the bridge. $\begingroup$ Probably the best 'visual' solution to a problem that I have ever seen. School in Edinburgh, Red Hill Field Primary School, Culford Prep v should be person or people. I, too, am looking forward to some experiments with automaton/8.One thing is clear though: Any such solution will also have to use iterative deepening (or a different complete search strategy) to find the shortest or fastest solution. Our story begins in the 18th century, in the quaint town of Königsberg, Prussia on the banks of the Pregel River. School, Howell's School in Cardiff,Archbishop Temple High School, Generalized Puzzle: A group of “n” people wish to cross a bridge at night. They will finally to cross the bridge within the time limit. "the question can be generalized for N people with varying individual time taken to cross the bridge.The below program works for a generic N no of people and their times. This gives us, B+A+D+B+B = 2+1+8+2+2 = 15.
There are two optimal strategies for solving this type of problem: Strategy 1 solves the original problem in 17 minutes This strategy makes A the torch bearer, shuttling each person across the bridge:This strategy does not permit a crossing in 15 minutes. Strategy 2will give us the fastest crossing. NRICH team work in a wide range of capacities, including providing professional development for teachers wishing to
since 4 items are 3 x second + first and fourth. The Overflow Blog Consider a narrow bridge that can only allow three vehicles in the same direction to cross at the same time. But then C or D must cross back to bring the torch to the other side, and so whoever solo-crossed must cross again. By clicking “Post Your Answer”, you agree to our To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
When Assume that a solution minimizes the total number of crossings. Also, assume we always choose the fastest for the solo-cross. -right - for two items going to the right the fastest is 1st and 2nd fastest , If two men cross together, they must walk at the slower man's pace. St.Paul's Catholic College, Cardiff High School,Casterton The flashlight must be walked back and forth; it cannot be thrown, etc.
Download Bridge_Crossing_Puzzle-noexe.zip - 430.3 KB; Download Bridge_Crossing_Puzzle.zip - 430.3 KB; Introduction. the formula for the shortest time is B+A+D+B+B or 3B+A+D then 5 items are 3 x second + first, third and fifth. 2,1+5} =4,sotheminimumis1+2+10+4=17. Each person has a different crossing speed; the speed of a group is determined by the speed of the slower member. In the Middle Ages, Königsberg became a very important city and trading center with its location strategically positioned on the river. Active 2 years, 1 month ago. Given the crossing times \$ t_1, t_2, \cdots, t_n \$ sorted in ascending order, there are two possibly optimal ways to help the worst person cross the bridge: \$ (t_1, t_n) \rightarrow t_1 \$: net effect is \$ t_n \$ crossing, and the cost is \$ t_n + t_1 \$. Free 30 Day Trial (Here we use A because we know that using A to cross both C and D separately is the most efficient.) -left - the 2nd fastest item. More like he is looking about the algo to solve this problem.I think this was the fastest down-vote I've ever gotten. Problem S4: Bridge Crossing. This is done by taking persons A, C, & D: C+A+D+A = 5+1+8+1=15. Now the person '1' will come back with total time of '10' minutes. I, too, am looking forward to some experiments with automaton/8.One thing is clear though: Any such solution will also have to use iterative deepening (or a different complete search strategy) to find the shortest or fastest solution. It is a simple CS problem.I prefer the missionary and cannibal problems myselfConsidering there will be 2 sides, side 1 and side 2, and N number of people should cross from side 1 to side 2. Several variations exist, with cosmetic variations such as differently named people, or variation in the crossing times or time limit.The puzzle is known to have appeared as early as 1981, in the book In the case where there are an arbitrary number of people with arbitrary crossing times, and the capacity of the bridge remains equal to two people, the problem has been completely analyzed by Martin Erwig from Oregon State University has used a variation of the problem to argue for the usability of the Haskell programming language over Prolog for solving The puzzle is also mentioned in Daniel Dennett's book
If there are three vehicles on the bridge, any incoming vehicle must wait as shown in the following figure. Anyway good try. Awesome! The question is, can they all get across the bridge if the torch lasts only 15 minutes?An obvious first idea is that the cost of returning the torch to the people waiting to cross is an unavoidable expense which should be minimized. I am basically looking for some generalized approach to these kind of problem. would like to check this out using the program.also i just looked at the pdf shared above, so for more items it is the sum of another set of timings when both Strategies would give identical I was told by my friend, that this can be solved by Fibonacci series, but the solution does not work for all.In general the largest problem / slowest people should always be put together, and sufficient trips of the fastest made to be able to bring the light back each time without using a slow resource.I would solve this problem by placing a fake job ad on Dice.com, and then asking this question in the interviews until someone gets it right.The puzzle is known to have appeared as early as 1981, in the book Super Strategies For Puzzles and Games.