Here’s a simple example to understand what binary search in computer science refers to. Let’s say, you had an array of numbers from 1 to 100. You have to choose one of them based on some given criteria and report your answer. You computer tells you whether your entry is too high, too low or correct.

To find the right answer, you can test number 50. If the computer tells you that your entry was too high, you know that the number should be between 1 and 50 but not including 50. So you have practically eliminated half the numbers in one run. Next you could enter 25 for instance which is some number around (1 + 50) /2 and see if your entry was too high, too low or the correct answer and by the same principle, you can eliminate half of the remaining numbers.

And running the test for a few times, you can get to the right answer. This is called binary search in computer science and is used in computer programs and algorithms very widely.