When you drop an egg from any floor of the building the egg will either break or it will survive the fall.
Floor eggs recursion problem.
So problem is reduced to n eggs and k x floors.
You have to minimize the number of times you have to drop the eggs to find.
You are given two eggs and access to a 100 storey building both eggs are identical.
If the egg breaks after dropping from xth floor then we only need to check for floors lower than x with remaining eggs as some floor should exist lower than x in which egg would not break.
You are given n floor and k eggs you have to minimize the number of times you have to drop the eggs to find the critical floor where critical floor means the floor beyond which eggs start to break.
In this article we are going to implement a c program to solve the egg dropping problem using dynamic programming dp.
If an egg breaks when dropped then it would break if dropped from a higher floor.
A building has 100 floors.
If an egg is dropped and does not break it is undamaged and can be dropped again.
An egg that survives a fall can be used again.
The aim is to find out the highest floor from which an egg will not break when dropped out of a window from that floor.
A broken egg must be discarded.
One of the floors is the highest floor an egg can be dropped from without breaking.
So problem is reduced is n 1 eggs and x 1 floors.
If egg does not break check the floors higher than x floors with all the n eggs are remaining.
If an egg survives a fall then it would survive a shorter fall.
In a toy example there is a tower of n n n floors and an egg dropper with m m m ideal eggs.
If the egg breaks then any greater fall would have broken it as well.
So the problem reduces to x 1 floors and n 1 eggs.
The physical properties of the ideal egg is such that it will shatter if it is dropped from floor n n n or above and will have no.
Egg dropping refers to a class of problems in which it is important to find the correct response without exceeding a low number of certain failure states.
Recursive equation n eggs k floors getdrops n k given n eggs and k floor building minimum of drops to determine the floor from which egg.
The two egg problem problem.
You are given n floor and k eggs.
Submitted by ritik aggarwal on december 13 2018.
The effect of a fall is the same for all eggs.