Question: Algorithms 4th edition Robert Sedgewick 1.4 creative problem 24(1.4.24) Throwing eggs from a building. Suppose that you have an N -story building and plenty of
Algorithms 4th edition
Robert Sedgewick
1.4 creative problem 24(1.4.24)
Throwing eggs from a building. Suppose that you have an N-story building and plenty of eggs. Suppose also that an egg is broken if it is thrown off floor F or higher, and unbroken otherwise. First, devise a strategy to determine the value of F such that the number of broken eggs is ~ lg N when using ~ lg N throws, then find a way to reduce the cost to ~ 2 lg F when N is much larger than F.
Hint: binary search; repeated doubling and binary search.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
