Linear Search - Lakelands Computing

Title
Go to content
Linear Search Algorithm
Searching is one of the most important ideas. We do it all the time although you might not realise it is a search, for example: you open your phone and search for a contact everytime you message someone.

Linear search is a very simple approach to searching, and can be quite slow but it does not need the list to be in order first which makes it a useful tool, especially with smaller lists where it won't take too long.

It works by starting at the first value and saying is this the target value (the thing you are searching for), if it is it reports that the target has been found, if not it moves onto the next value - is this the target? No, move on to next value. When it finds the target value it reports back its position in the list. The video shows this clearly:
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