Binary Search - Lakelands Computing

Title
Go to content
Binary Search Algorithm
Binary Search is quicker than Linear Search but it needs the list to be sorted first.

It works in the same way that humans try and find something in an ordered list (sort of).

It splits the list in half, and compares the target value to the mid point of the list (the lowest value in the upper half). If the target is more than this mid point value , you "throw away" the half of the list filled with lower numbers (if the target is smaller than the mid point value, you throw away the half list with higher numbers).

You then take the half list you kept, and split it in half, comparing this new mid point value to your target... and then repeat the process until you find your target , or discover it doesn't exist in the list.

The first 2 minutes of the video explain this with an example. The rest of the video talks about speed of the search algorithm etc, worth a watch if you are doing GCSE Computer Science and thinking about taking it further.
All Text copyright Lakelands Academy & Mr T Purslow 2020.
All images copyright free / creative commons unless otherwise stated.
You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
All Text copyright Lakelands Academy & Mr T Purslow 2020.  All images copyright free / creative commons unless otherwise stated. You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
All Text copyright Lakelands Academy & Mr T Purslow 2020.  All images copyright free / creative commons unless otherwise stated. You are welcome to use under a Creative Commons Attribution-nonCommercial-ShareAlike License.
Back to content