Given an unlimited number of light bulbs (that break at a certain height), and a building with 100 floors, how do you determine the height that the light bulb breaks?

The solution is a binary search algorithm (where you start on floor 50th and move up or down depending if the bulb breaks or not, always picking the middle floor of your option range).

DG

Related Computing A Level answers

All answers ▸

Choose 3 types of malware, describe them and the ways in which they may harm a device.


why is the Harvard architecture is sometimes used in preference to the von Neumann architecture and give examples of each system


In a computer program, a parameter may be passed to a procedure by value. Explain how this method works.


Write pseudocode for the linear search algorithm, and then explain it’s complexity using big-O notation