# Linear Search KS3 Resources

## Teach KS3 Students About Linear Search, Save Hours of Prep!

Do you want to save hours of lesson preparation time? Get your evenings and weekends back and focus your time where it's needed! Be fully prepared with presentations, notes, activities, and more.

All Computer Science topics are covered, and each module comes complete with:

• Classroom Presentations
• Revision Notes
• Activities & Quizzes
• Mind Maps, Flashcards & Glossaries

#### What is linear search?

Linear search is a simple search algorithm that checks each element in a list or array, one at a time, until it finds the desired element or determines that the element is not in the list. It has a time complexity of O(n) where n is the number of elements in the list.

#### How does linear search compare to binary search?

Linear search is a simpler and less efficient algorithm than binary search. Binary search is a more efficient algorithm that can search for an element in a sorted list or array by repeatedly dividing the search interval in half. It has a time complexity of O(log n) where n is the number of elements in the list.

#### When is it appropriate to use linear search over other search algorithms?

Linear search is appropriate when the list or array is small or unsorted, or when the search key is not known in advance. It is also useful in situations where the list is not sorted and other search algorithms like binary search can't be used.

#### How does linear search handle duplicate elements in a list?

Linear search checks each element in the list one at a time, so if there are duplicate elements, it will return the index of the first occurrence of the element in the list. If you want to find all the occurrences of an element, you will have to implement a loop and check all the elements in the list.