这是来自Robert Sedgewick的《算法(第四版)》中的练习问题1.4.24。
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 unhurt otherwise.
First, devise a strategy to determine the value of F such that the number of
broken eggs is ~lgN when using ~lgN throws, then find a way to reduce the cost to
~2lgF.
虽然lgN
的解决方案很容易想到,但我完全不知道2lgF
的解决方案。无论如何,由于我们没有给出F
的值,因此2lgF
解决方案的基础在哪里?
有人能为这个问题提供一些提示吗?谢谢。