Algorithm - find the minimal time
Posted
by
exTyn
on Stack Overflow
See other posts from Stack Overflow
or by exTyn
Published on 2010-12-29T01:39:25Z
Indexed on
2010/12/29
1:54 UTC
Read the original article
Hit count: 684
I've found this problem somewhere on the internet, but I'm not sure about the proper solution. I think, that it has to be done by greedy algorithm, however I haven't spend much time thinking about that.
I suppose, You may enjoy solving this problem, and I will get my answer. Win-win situation :).
Problem
N people come to a river in the night. There is a narrow bridge, but it can only hold two people at a time. Because it's night, the torch has to be used when crossing the bridge. Every person can cross the bridge in some (given) time (person n1 can cross the bridge in t1 time, person n2 in t2 time etc.). When two people cross the bridge together, they must move at the slower person's pace. What is the mimimal time for the whole grup to cross the bridge?
© Stack Overflow or respective owner