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 ▸

What is the difference between local and global variables?


Why indentation is important in Python and what is the scope of a global variable?


What are the different development methodologies and what are their advantages and disadvantages?


Explain why it is important to check the email address with JavaScript and again when it reaches the server.