Photo AI
Last Updated Sep 27, 2025
Revision notes with simplified explanations to understand Linear Search quickly and effectively.
340+ students studying
Linear Search is a simple algorithm used to find the position of a target value in a list. It works by sequentially checking each element of the list until the target is found or the end of the list is reached. Linear Search is easy to implement but can be inefficient for large datasets.
Given the array:
3, 7, 10, 15, 18, 20
Target: 15
Step-by-Step Execution:
METHOD LinearSearch(array, target)
FOR i FROM 0 TO array.length - 1
IF array[i] = target
RETURN i // Target found at index i
ENDFOR
RETURN -1 // Target not found
def linear_search(array, target):
for i in range(len(array)):
if array[i] == target:
return i # Target found
return -1 # Target not found
# Example usage:
data = [3, 7, 10, 15, 18, 20]
print(linear_search(data, 15)) # Output: 3
print(linear_search(data, 5)) # Output: -1
Given the array:
2, 5, 8, 12, 16, 23, 38
Target: 23
Enhance your understanding with flashcards, quizzes, and exams—designed to help you grasp key concepts, reinforce learning, and master any topic with confidence!
120 flashcards
Flashcards on Linear Search
Revise key concepts with interactive flashcards.
Try Computer Science Flashcards12 quizzes
Quizzes on Linear Search
Test your knowledge with fun and engaging quizzes.
Try Computer Science Quizzes29 questions
Exam questions on Linear Search
Boost your confidence with real exam questions.
Try Computer Science Questions27 exams created
Exam Builder on Linear Search
Create custom exams across topics for better practice!
Try Computer Science exam builder12 papers
Past Papers on Linear Search
Practice past papers to reinforce exam experience.
Try Computer Science Past PapersDiscover More Revision Notes Related to Linear Search to Deepen Your Understanding and Improve Your Mastery
Join 500,000+ A-Level students using SimpleStudy...
Join Thousands of A-Level Students Using SimpleStudy to Learn Smarter, Stay Organized, and Boost Their Grades with Confidence!
Report Improved Results
Recommend to friends
Students Supported
Questions answered