https://www.includehelp.com/algorithms/egg-dropping-problem-using-dynamic-programming.aspx
plz look at the example given on this site and its explaination…
input 1:
eggs =2,floors=4
Explanation of the problem:
For the Input 1,
Case 1. Drop at first floor:
-
Egg does not break:
If egg does not break then we have three floors left and two eggs. We can either choose 2nd or 3rd floor and proceed similarly but we can easily see we have to do atleast 3 trials.
-
Egg breaks:
If egg breaks then we found the critical floor in only 1 trial.
In case 1, the worst possibility is that egg does not break so trials will be 3 for case 1.
Case 2. Drop at second floor:
-
Egg breaks:
We are left with one egg and we have to check only 1 floor so number of trials 2.
-
Egg does not break:
We still have two eggs and two floors to check we have to check one by one on these floors so trials needed are 3.
So for case 2 together the worst possibility is 3.
In the end we have to find the minimum of case 1, case 2, case 3, case 4.
this explaination shows that for floor 1 trials are 3 …