Arrays, Pointers, and Strings (cont.) - chapter 6


Arguments to main


Ragged arrays


Functions as arguments


Find a root of f() by the bisection method


Const and pointers


Riddle - Crystal Balls

You have b identical crystal balls. There is a high rise with a f floors. One of the floors could be critical. When a crystal ball is dropped from the critical floor or from a higher floor the ball breaks. You need to find the critical floor with the minimum number of experiments in the worst case. Each drop is counted as one experiment regardless of whether the ball breaks or not.

For example, if you have only one ball, you must start your experiments from the first floor. In the worst case you will end up performing an experiment every floor just to find out that there is no critical floor. Given one ball the minimum number of experiments required in the worst case is f.

top prev


Last modified: July 24 2004.