How does a linear search work?
A linear search checks each item in a list in order until it finds the target or reaches the end. Set a found flag to false, loop through the list, and if an item matches, set found to true and record its position. It works on unsorted lists but can be slow, because every item may need checking.
Formula
Reviewed by
Want one-to-one support?
One-to-one online tuition can help you build confidence in your subject. Find a tutor who teaches your course.
Find a TutorLearn face to face in Glasgow
Prefer in-person lessons? Visit the ExpertTutor Glasgow Southside centre.
See the centre