There is a 100 storey tower and you are given some number of crystal glass balls. You want to determine the lowest floor at which a crystal glass ball breaks.What is the most efficient way of doing this?
Hint: You take a crystal glass ball and drop it from 1st floor and if it does'nt break, you drop the same ball from second floor and check now.
Answer:
We need at least 2 crystal glass balls. Take ball no 1 and drop it from floor no 1, if it does not break, got to floor no 10 and drop it. If it does not break drop from floor no 20, do this from 30th, 40th, 50th,60th,70th floors. Suppose in out case the ball breaks from 76th floor, then by dropping it from 80th floor the ball breaks.
Now we know that the ball breaks in the floor that lies between 71 to 80. Take the second ball and drop it from 71th floor and continue for 72th,73rd,74th, 75th and 76th. In our case the ball breaks in 76th floor.
So with 2 balls and least number of tries we determined the floor.
Saturday, October 25, 2008
Subscribe to:
Post Comments (Atom)
.jpg)
No comments:
Post a Comment