Main BLOGGER
Google
WWW THIS BLOG
Thursday, March 31, 2005
 
Cracking Eggs Problem
You have a 100 story building and You are now given 2 identical eggs. There is some floor below which the egg will not break if dropped. What is the worst case upper bound on the number of drops you must make to determine this floor?

Answer:
Suppose our upper bound is k. For our first drop we could try a floor as high as floor k because at the worst case when the first egg breaks, we still have the second egg and k-1 remaining drops to determine the threshold floor. If the egg doesn't break, we keep moving up and we can now move (k­-1) floor (=k+k-1) further because we have k-1 drops left. So eventually we move up as high sum(k,k-1,...,1) =(k+1)*k/2

The smallest value of k such that this value will be # 99 is 14.



<< Home

Powered by Blogger

Google
WWW THIS BLOG