# Posts Tagged ‘travelling bird puzzle’

## Travelling bird puzzle

Posted by guptaradhesh on October 24, 2010

Two trains start 20 miles apart and head toward each other, each going at a steady speed of 10 m.p.h. At the same time, a bird that travels at a steady 15 m.p.h. starts from the front of the first train and flies to the front of the second one, and then turns around and flies to the front of the first train again, and continues in this manner till the trains meet.

(a)  How much distance will the bird cover before the trains meet?
(b) How many trips will the bird make?
Solution:
This is similar to Microsoft’s famous interview puzzle – One train leaves Los Angeles at 15mph heading for New York. Another train leaves from New York at 20mph heading for Los Angeles on the same track. If a bird, flying at 25mph, leaves from Los Angeles at the same time as the train and flies back and forth between the two trains until they collide, how far will the bird have traveled?
Part (a)

The relative speed between the two trains is 20 mph. So they meet after 20/20 i.e. 1 hour. The bird would have travelled 15*1=15 miles.

Part (b)

Consider that the trains are ‘x’ miles apart.

The bird takes x(15+10) hours to make a trip. The distance between the trains reduces to x-(10*x/25)*2 = x/5 miles. This means that one trip of the bird reduces the distance between the trains to one-fifth. Given that the trains start 20 miles apart, we can say the distance between the trains after  trips of the bird would be 20/(5^t). Thus we get the total number of trips of the bird as :

The answer, though mathematically logical and valid, is pretty little hard to digest. The problem here assumes that bird takes almost NO time to switch its journey between the trains. Even a small ‘delta’ time consideration of switching would have given finite number of trips.

Posted in puzzles/ algorithms | Tagged: , , | 1 Comment »