Question: I need the basic algorithms preferably in c++, an explanation for them, and the runtime complexity too. P4 (30pt): Eggs break when dropped from great

 I need the basic algorithms preferably in c++, an explanation for

I need the basic algorithms preferably in c++, an explanation for them, and the runtime complexity too.

P4 (30pt): Eggs break when dropped from great enough height. Specifically, there must be a floor f in any sufficiently tall building such that an egg dropped from the fth floor breaks, but one dropped from the (f - 1)st floor will not. If the egg always breaks, then f=1. If the egg never breaks, then f=n+1. You seek to find the critical floor f using an n-story building. The only operation you can perform is to drop an egg off some floor and see what happens. You start out with k eggs, and seek to drop eggs as few times as possible. Broken eggs cannot be reused. Let E(k,n) be the minimum number of egg droppings that will always suffice. 1. (a) Show that E(1, n)=n. 2. (b) Show that E(k, n)=O(n+/k). [Hint1: Try to recurse; Hint2:mathematical induc- tion on k. Hint3: treat variables as real numbers and minimize via derivative. ] 3. (c) Find a recurrence for E(k,n). What is the running time of the dynamic pro- gram to find E(k,n)? (Note: this is different from (b). k,n, E(k,n) have to be integers.]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!