Two Egg problem:
I am sure the two egg problem ( mentioned above ) has been discussed sufficiently. However could someone help me understand why the following solution is not optimal.
Let's say I use a segment and scan algorithm with the segment size s
.
So,
d ( 100 / s + (s-1) ) = 0 [ this should give the minima, I need '(s-1)' scans per segment and there are '100/s' segments]
-
ds
=> -100 / s^2 + 1 = 0
=> s^2 = 100
=> s = 10
So according to this I need at most 19 drops. But the optimal solution can do this with 14 drops.
So where lies the problem?
Drop the egg from the first-floor window; if it survives, drop it from the second-floor window. Continue upward until it breaks. In the worst case, this method may require 100 droppings.
The Problem One of the floors is the highest floor an egg can be dropped from without breaking. If an egg is dropped from above that floor, it will break. If it is dropped from that floor or below, it will be completely undamaged and you can drop the egg again.
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. In a toy example, there is a tower of n floors, and an egg dropper with m ideal eggs.
There are two ways that a woman may conceive twins. In one case, her ovaries release two eggs at the time of ovulation, and both are fertilized and become embryos; this results in fraternal, or nonidentical, twins. In contrast, identical twins are conceived when one embryo splits into two early in its development.
You seem to be assuming equal-sized segments. For an optimal solution, if the first segment is of size N, then the second has to be of size N-1, and so on (because when you start testing the second segment, you've already dropped the egg once for the first segment).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With