In many real-life situations, people need to locate a specific item from a large collection of ordered information.
For example, finding a name in a telephone directory, searching for a word in a dictionary,
locating a contact in an alphabetically sorted list, or looking up a record in a database.
Checking each item one by one is time-consuming and becomes increasingly inefficient as the amount of data grows.
This raises an important question: How can we quickly locate the required item while minimizing the number of comparisons?
Solving this problem requires a systematic search strategy that reduces unnecessary effort and improves efficiency.
Binary Search finds a value inside a sorted collection by repeatedly checking the middle element and discarding the half that can't contain the answer. It starts with low = 1 and high = n β the first and last positions of the collection. The target is compared against the value at the middle position: if they match, the search is over. If the target is larger, everything up to and including the middle is discarded; if it's smaller, everything from the middle onward is discarded. This process of recomputing the middle, comparing, and narrowing the range repeats until the target is found or the range collapses entirely, meaning it isn't present.
Match β done. Target larger than mid β low = mid + 1. Target smaller β high = mid β 1. Repeat.
You watched the Room repeatedly cut its own search space in half β 0 tries, and it found the exit.
Now it's your turn. New doors, same rules β click any door and observe the pattern yourself.
Every door you tried cut what was left in half β you were only ever hunting for where the exit couldn't be.
That's why this room falls in at most 10 tries out of 600 doors.
Going back will lose your progress on this page, and you'll need to reach it again through Next.
Are you sure you want to go back?