Linear Search
Also known as: sequential search
A search algorithm that checks each element in a list one by one until the target is found. Works on unsorted data; baseline to compare against more efficient algorithms.
๐ก Intuition
Looking for your keys by checking every pocket and drawer in order.
Core Idea
Simple but slow for large lists โ must check up to every element in the worst case.
๐ฌ Example
๐ฏ Why It Matters
Works on unsorted data; baseline to compare against more efficient algorithms.
โ ๏ธ Common Confusion
Linear search works on any list; binary search is faster but requires sorted data.
Related Concepts
Next Steps
How Linear Search Connects to Other Ideas
To understand linear search, you should first be comfortable with searching and array. Once you have a solid grasp of linear search, you can move on to binary search and efficiency.
Go Deeper
Frequently Asked Questions
What is Linear Search in CS Thinking?
A search algorithm that checks each element in a list one by one until the target is found.
Why is Linear Search important?
Works on unsorted data; baseline to compare against more efficient algorithms.
What do students usually get wrong about Linear Search?
Linear search works on any list; binary search is faster but requires sorted data.
What should I learn before Linear Search?
Before studying Linear Search, you should understand: searching, array.