Binary Search

Binary search is often one of the first algorithms you will encounter when learn starting to learn data structures and algorithms.

One of the better explanations I have heard is based on a real world problem that may or may not still be in use. Say you are handed a stack of papers with the name of the person it belongs to at the top. The papers are arranged in alphabetical order based on that name. When a person comes to you asking for you for their paper it is your job to search through those papers and find it.

Someone with the name of Mary comes to you first. Where do you start your search? Would you simply start from the beginning? No!

Binary search is dependent on the items that are being searched to be in order. This means that there is a dependable way to figure out which half is ideal for searching and which can be discarded.

Binary Search Resources #

Share this by sharing it. Twitter me if you want to.

Published