4.2.2.1 Linear Search
4.2.2.1 Linear Search
(Difficulty Note: This is a very intuitive and accessible concept for 7th graders.)
Linear Search is the simplest way to find something. It's like looking for a book in a messy pile without any order. You start at the very beginning of the list of items and check each item one by one until you find what you're looking for, or until you reach the end of the list.
How it works:
- Start at the first item.
- Is this the item you're looking for?
- If Yes, you found it! Stop.
- If No, move to the next item.
- Keep doing this until you find the item or run out of items to check.
Example: Imagine you have a list of numbers: [5, 12, 3, 8, 15, 7]
and you're looking for the number 8
.
- Check
5
(No) - Check
12
(No) - Check
3
(No) - Check
8
(Yes!) – You found it!
When is it used? Linear search works well for short lists or lists that are not sorted in any particular order. It's easy to understand and program. However, if you have a very long list, it can be slow because you might have to check every single item.
Bibliography:
- Linear search facts for kids. (n.d.). Kiddle. Retrieved July 11, 2025, from https://kids.kiddle.co/Linear_search
- What is Linear Search? (n.d.). Programiz. Retrieved July 11, 2025, from https://www.programiz.com/dsa/linear-search
Further Reading:
- Linear Search Explained. (2020, January 27). freeCodeCamp.org. Retrieved from https://www.freecodecamp.org/news/linear-search/