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 ▸

Describe the difference between passing parameters into a function by reference and by value? Indicating how this may lead to unexpected outputs.


What is the decimal equivalent of the following sequence of bits, which represents an unsigned binary integer: 1101001. What is the decimal equivalent if the sequence in bits encodes a two’s complement binary integer.


Given a graph with n nodes and m edges, every edge has a passing cost that can be negative, find the minimum distance between node 1 and every other node


Convert the hexadecimal '3E', which represents a 2's compliment binary number, in decimal.