# Binary Search real life examples

Binary search algorithm is one of the most simple and widely used algorithms. It has immense application. So much that we use binary search in our real lives without even realizing it. We will discuss some real-life examples of binary search in various fields.

## Real life examples of Binary Search

### Dictonary

English contains thousands of words. We cannot possibly remember every single word. So, we use dictionaries to help us find the meaning of different words. A dictionary is basically a list of words of a language in alphabetical order.

Suppose we wish to search for the meaning of the word “Serenity”. One way to find the word is to read each word of the dictionary from start and compare it to the word we want to search. But this method is very time-consuming. It will take several minutes to hours to search for the keyword.

We can optimize the task using a binary search. We go to the middle page and compare the words on that page with “Serenity”. If the “Serenity” is alphabetically smaller than the word on the middle page then we can ignore all pages on the right side. If “Serenity” is alphabetically larger than the word on the middle page then we ignore all pages on the left side. We keep repeating this process until we find the word.

### Height of Students

Suppose you require some students for annual function, for some drama, or sports-related activity. The task demands someone who is taller than 5 inches.

The problem is most students aren’t sure about their height. You have a measuring instrument but measuring the height of each student is time-consuming. We can optimize the process using a binary search.

First, we will ask students to make a line in ascending order of their height. After that, we can use binary search to find all students with a height just above 5 inches.

Example,

We found all the students taller than 5 inches by measuring height of just 4 students.

### Library

A library contains thousands of books. Searching for a book linearly is not feasible.

Books in a library are generally arranged in alphabetical order or by some integer code. Therefore, instead of linearly checking each and every book in the library, we can simply use a binary search to find the book.

### Page Number

This might be the most common real-life example of binary search. Suppose we want to go to page 345 in a book. We don’t visit every page from 1 to 345. We open any random page on the book and check it’s page number. If the current page number is greater than 345, then 345 is on the left side of the current page. If the current page number is smaller than 345, then 345 is on the right side of the current page. We keep repeating the process until we reach page 345.

### University

Many universities or colleges ask for certain documents during admission. The documents are generally stored in an ordered manner on the basis of student roll number.

Using a linear search to find student documents can be cumbersome and inefficient. The university staff can simply use binary search and access the data.